OK, the 32.768kHz crystals I ordered finally arrived, so i'm trying to get this working, but it looks like the timer is not waking up the PIC.
I tested the timer by itself and its happily overflowing every 2 seconds, but either its not running when in sleep mode, or it is and the overflow isnt waking up the PIC.
Code:
ADCON0=%00000000
ADCON1=%01111111
T1CON=%00001111
TMR1IE VAR PIE1.0
TMR1IF VAR PIR1.0
TMR1IE=1
'... main code here - calls countdown suburoutine ...'
countdown:
LCDOUT $FE,1,$FE,2,"Starting"
TMR1IF=0
@ SLEEP
@ NOP
LCDOUT $FE,1,$FE,2,"Time Remaining"
GOSUB update_lcd
GOSUB update_time_vars
IF timeup=1 then RETURN
GOTO countdown
I get "Starting" displayed on the LCD, but that's it, I never see "Time Remaining".
Any ideas?
edit: config, in case its relevant:
Code:
__CONFIG _CONFIG1H, _INTIO2_OSC_1H
__CONFIG _CONFIG2H, _WDT_OFF_2H
__CONFIG _CONFIG3H, _MCLRE_ON_3H
__CONFIG _CONFIG4L, _DEBUG_OFF_4L & _LVP_OFF_4L
Bookmarks