I'm using a 12F629 . The program is suposed to make the LED on the board come on for 2 seconds, then wait for 20 seconds and come on again for 2 seconds, then sleep unles interupted for 5 min. If interupted it is to make the LED shine for 2 seconds and return to the 5 min routine. At the end of the 5 min period with no interupts it is to go to the main program where there is a different interupt routine.

What is happening is whenever it is interupted in the 5 min period, it seems to stall for about 2 seconds and then returns to the beginning of the program. I have confirmed the return to the beginning. It never seems to end the 5 min period and go to the main portion of the program.

Any help would be appriciated.

@ DEVICE pic12F629, INTRC_OSC_NOCLKOUT ; System Clock Options
@ DEVICE pic12F629, WDT_ON ; Watchdog Timer
@ DEVICE pic12F629, PWRT_ON ; Power-On Timer
@ DEVICE pic12F629, MCLR_OFF ; Master Clear Options (Internal)
@ DEVICE pic12F629, BOD_OFF ; Brown-Out Detect
@ DEVICE pic12F629, CPD_ON ; Data Memory Code Protect
@ DEVICE pic12F629, PROTECT_OFF
;
; Set Variables and aliases
; SENSOR input on GPIO.2 - PULL PIN HIGH to trigger
SYMBOL LED = GPIO.0
SYMBOL SENSOR = GPIO.2
SYMBOL CAMPOW = GPIO.4
SYMBOL CAMSHUT = GPIO.5
BO VAR word
BO = 0
;
; Set External interrupt (GPIO.2) with rising edge trigger...
OPTION_REG = %00001100 ; Enable pullups, riseing edge trigger on GP.2, etc
CMCON = %00000111 ; Comparators OFF
INTCON = %10000000 ; Set GIE - clear interrupt enable bit and flags.
;
;
LOW CAMPOW : LOW CAMSHUT : low LED ;Set output pins
pause 2000
high led
pause 20000
low led
pause 2000
high led
WALKTEST:
INTCON = %10010000 ; Set/re-set interrupt enable bit - clear flags
ON INTERRUPT GOTO LTINT
SLEEP 270 'SLEEP FOR 5 MIN
GOTO BASE
;
; LED Interrrupt handler
LTINT:
INTCON = %10000000 ; clear interrupt enable bit and flags
low LED
PAUSE 2000
high LED
resume WALKTEST
;
; Interrrupt handler
MYINT:
INTCON = %10000000 ; clear interrupt enable bit and flags
; Camera Shutter & Power control
HIGH CAMPOW 'PRESS POWER
PAUSE 2000 'HOLD POWER FOR 500 MILLISECOND
LOW CAMPOW 'RELEASE POWER
pause 500
HIGH CAMSHUT 'PRESS SHUTTER FOR 2 SECONDS
PAUSE 2000
LOW CAMSHUT 'RELEASE SHUTTER
PAUSE 10000 'ALLOW 6 MORE SECONDS TO SAVE AND TURN CAMERA OFF
HIGH CAMPOW 'TURN CAMERA OFF
PAUSE 3000
LOW CAMPOW
pause 3000
RESUME BASE ; resume at BASE section
;
; Refresh routine
REFRESH:
HIGH CAMPOW 'PRESS POWER FOR 1 SECOND
Pause 1000
LOW CAMPOW 'RELEASE POWER
PAUSE 3000
HIGH CAMPOW 'PRESS POWER FOR 3 SECONDS
PAUSE 3000
LOW CAMPOW 'RELEASE POWER
RESUME BASE
; Main program
BASE:
INTCON = %10010000 ; Set/re-set interrupt enable bit - clear flags
;
LOOP:
ON INTERRUPT GOTO MYINT
SLEEP 1200 'SLEEP FOR 20 MIN
goto refresh
GOTO LOOP