My program runs OK the first time, but interrupt does not go to start. It wakes from sleep (clock is active) but just idles. What am I doing wrong? This is the program:
'* Notes : Power up starts the time and turns on a FET *
'* : switch. After 15 minutes, the FET switch is *
'* : is turned off. If the stop switch is pressed *
'* : while the timer is running, the FET is turned off;*
'* : and the timer goes to sleep. The start switch *
'* : (interrupt) wakes the timer and starts it. *
'************************************************* ***************
REM device = 12F675
CMCON = 7 ' SETS DIGITAL MODE
ANSEL = 0 ' GPIO.0 TO GPIO.3 SET AS DIGITAL
OPTION_REG = 0 ' WEAK PULLUPS ENABLED
TRISIO = %00001100 ' GPIO.2 AND GPIO.3 SET AS INPUT
IOC = %00000100 ' INTERRUPT ENABLED ON GPIO.2
VRCON.7 = 0 ' TURN OFF VOLTAGE REFERENCE
N VAR WORD ' VARIABLE N DEFINED
ON INTERRUPT GOTO AGAIN
INTCON = %10010000 ' INTERRUPT ENABLED
' ************************************************** ***********
START:
INTCON.1=0 ' Clear GP2/INT flag
HIGH GPIO.0
FOR N=1 TO 900
IF GPIO.3=0 THEN SLEEPNOW
PAUSE 1000
NEXT N
SLEEPNOW:
LOW GPIO.0
SLEEP 1 ' WDT is turned off so I think it does not wake uP.
AGAIN:
GOTO START
resume
END
Bookmarks