Hi Bruce,
Iīm using Micrchips MPASM and PBP 2.50
Did you use 20 MHz on a veroboard?
Hi Bruce,
Iīm using Micrchips MPASM and PBP 2.50
Did you use 20 MHz on a veroboard?
I have never used vero board or a 20MHz canned type TTL clock oscillator, but I do use
20MHz crystals & resonators on breadboards pretty often.
What is the error you're seeing when you compile? The example I posted compiles fine here!
Edit: Which PIC are you compiling for? There are differences in config options between some
device types.
Last edited by Bruce; - 12th February 2008 at 12:47. Reason: PIC type
Hi Guys!
This works:
'************************************************* *******************************************
' 16F628A 20Mhz extern canned Oscillator
' damn program should blink an LED
' Yeah Works!
'************************************************* *******************************************
@config_EXTCLK_OSC
DEFINE OSC 20
LED VAR PORTB.7
CMCON = 7 ' RA0-RA3 are digital I/O
TRISB = %01111111 ' RB7 is output, rest are inputs.
main:
led = 1
pause 500
led = 0
pause 500
goto main
END ' End of program
And heres the mistake:
http://hobby_elec.piclist.com/e_pic8_8.htm
Look at the osc wiring diagram: ext osc MUST be connected to RA6! hahahaha!
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.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Hi Joe,
iīm using the PicKit2 and i didnīt find any osc settings in the programmer window. That was what I tried at first.
had the Velleman programmer before and this had the possibility to set osc configs. But that one died long ago.....simply didnt work anymore.
on the other hand: PicKit2 is fast an easy to use and supports everything, even the 16F628A...hahaha
Hi Bruce,
I know the datasheet shows RA7 is external clock in..but I dont get it working. When connecting to RA6 it works. should I try a long-time test if the pic gets to hot? maybe a resistor between canned oscillator and PIC?
Hi Mugelpower,
Here is what I think, <b>I say think because I do not definately know.</b> Being that your config fuse setting is WRONG, I think your PIC is not properly set up for EXT OSC and that is why it will not accept input on RA7, I THINK it it using the oscillator as a crystal, somehow getting enough signal to work, elsewise it may be defaulting to int osc, who can say? Try sending out some serial data to a serial lcd and see if it scrambles the data, better yet correct your config statement and then try the OSC on it's proper pin. I compiled your code both ways and the hex files have some distinct differences. One more thought, the PIC is probably using the default config statement in the 16F628A.inc file, unless you have commented it out.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks