I have been having problems with getting a 16F631 to operate correctly. I have tried both an internal and external oscillators. Under both circumstances the code seems to run 2 times faster or more. I have a very basic blinking LED program, 2 seconds on 2 off. I'm using PBP compiler 2.60.
Code:
@ __config _HS_OSC & _WDT_ON & _MCLRE_OFF & _CP_OFF & _IESO_OFF
'@ __config _INTOSCIO & _WDT_ON & _MCLRE_OFF & _CP_OFF & _IESO_OFF
Clear
define osc 10
'define osc 8
OSCCON = %01101110 'external 10 mhz
'OSCCON = %01111111 'internal 8 mhz
ANSEL = 0 'set port to digital
OPTION_REG.7 = 0 'enable pull ups on A and B
TRISA = %011000 '
TRISB = %11001111 '
TRISC = %11111111 '
PORTA = 0
Pause 500
fake_main:
PORTA.0 = 0
pause 2000
PORTA.0 = 1
pause 2000
goto fake_main
end
This problem is frustrating me and is probably either very obvious or very difficult.
Thanks for the help
Bookmarks