Try this:
@ __CONFIG_EXTCLK_OSC
DEFINE OSC 20
Try this:
@ __CONFIG_EXTCLK_OSC
DEFINE OSC 20
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.
Make sure you call-out all config options you need in the config directive line. Otherwise
they default to options you may not be aware of that can stop you dead in your tracks.
/MCLR is by default reset, and LVP is by default on. If you only indclude _EXTCLK_OSC, then
LVP is enabled, and can really screw things up.
Give this a shot.
Code:@ __config _EXTCLK_OSC & _WDT_OFF & _MCLRE_OFF & _LVP_OFF & _CP_OFF DEFINE OSC 20 LED VAR PORTB.7 CMCON = 7 ' RA0-RA3 are digital I/O PORTB = %01111111 ' set port latches TRISB = %01111111 ' RB7 is output, rest are inputs. main: led = 1 pause 500 led = 0 pause 500 goto main END ' End of program
Hi Bruce,
I tried your Program but it gave me a compilation error I didnīt understand something like out of memory.
I tried Joes Define instead which at least showed no compilation error.
My small setup sits on a veroboard and I tried to hold all Cu-lines as short as possible and used the some capacitors etc.
99% of the time it didnīt work but some seconds the Led blinked as expected.
Tried some other 20Mhz 16F628A but they showed all the same behavior. Scope said the canned Oscillator is ok,. tried to use different resistors in line, parallel , from +5V to signal because it could have an open collector output......
In the evening I try again with a crystal. Damned!
To use this config directive you need to use the MPASM assembler, and comment out any
MPASM config statments in the default PBP device header file.
If you're using the PM assembler, then change it to;
@ DEVICE EXTCLK_OSC, WDT_OFF, MCLR_OFF, LVP_OFF, PROTECT_OFF
If you're still having trouble see this thread http://www.picbasic.co.uk/forum/showthread.php?t=543
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!
Bookmarks