I'm trying to get the 12F683 to run on an external crystal at 20 mhz...with no luck.
I've played with the OSCON and had it run at 1, 2, 4 and 8 Mhz. The Define command doesn't seem to do this though.
How do I setup the 12F683 for 20 mhz??????
Here is some code I'm playing with.
[HTML]'config_wdt_on
'config_fosc2_off
'config_fosc1_on
'config_fosc0_off
'config_ircf2_on
'config_ircf1_off
'config_ircf0_off
'define osc 20
'cfg %111111111111010
'osccon = %01001000 ' Osc set to 1 MHz
'osccon = %01100000 ' Osc set to 4 MHz
osccon = %01110000 ' Osc set to 8 MHz
trisio = %00011000 '
wpu = %00011000
CMCON0 = 7 ' Analog comparators off
ANSEL = 0 ' Analog select set to digital, pg 69 data
ADCON0 = 0 ' A/D turned OFF, pg 68 of data
pausetime var word
Out0 var gpio.0
Out1 var gpio.1
Out2 var gpio.2
B0 var byte
'input gpio.4
' SET VARIABLES
pausetime = 100
B0 = 0
low 0
low 1
low 2
start:
'button gpio.3,1,10,5,B0,1,notp
if gpio.3 = 1 then goto start
call blink0
call blink2
call blink1
goto start
blink0:
high out0
pause pausetime
low out0
'pause pausetime
return
blink1:
high out1
pause pausetime
low out1
'pause pausetime
return
blink2:
high out2
pause pausetime
low out2
'pause pausetime
return
notp:
goto start
end
[/HTML]
Bookmarks