I'm glad you got that working, however, this @config_EXTCLK_OSC is totally not a good or valid config directive.
It doesn't throw an error, but it also doesn't do anything. I suspect you have whatever default config settings in the device .INC file that are actually being used.
It may work, but you will have issues down the road with your canned oscillator, PIC, or both shortly. RA6 on this device is NOT the external clock input. RA7 is.
If you have a canned oscillator, like the 2nd picture in this link http://hobby_elec.piclist.com/e_pic8_8.htm then you do not want to connect the output of this oscillator to RA6.
If you have XT, HS or any other config setting to enable the OSC2 output, then you have two outputs connected together, and you'll want a lot of spare parts.
If you're using the default PM assembler;
@ DEVICE EXTCLK_OSC, WDT_OFF, MCLR_OFF, LVP_OFF, PROTECT_OFF
If you have MPASM selected as the assembler;
@ __config _EXTCLK_OSC & _WDT_OFF & _MCLRE_OFF & _LVP_OFF & _CP_OFF
Note: Option #2 will indeed return an error unless you have the MPASM config line in the default 16F628A.INC file commented out.
If your device programmer supports it, simply compile, open the .hex file, and verify your config settings. If it is NOT set to EC oscillator, then you will for sure have major problems down the road. Just FYI.
It may work with XT or HS since you have a canned oscillator output connected, but I wouldn't expect something like this to last since OSC2 would also be trying to drive the external crystal.
If you have a 20MHz crystal, then the circuit shown in the 1st graphic is the way to go.
Bookmarks