i see quite a few mistake here- there's no Goto Start after your LED blink
- Disable INTERRUPT is not placed at the right place
- you can't have more than 1 ON INTERRUPT GOTO
- the first ON INTERRUPT is not a the right place
- not sure about the NAP loop... to me PAUSEUS would be a better option
- not sure about SLEEP in the ISR
- yes you MUST clear INT flag
- There's no RESUME at the end of your ISR
- WAIT is a reserved word and can't be used for labels
but the rest is OK 
Something like bellow should work
Code:
@ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN_ON
CMCON = 7 ' SETS DIGITAL MODE
ANSEL = 0 ' GPIO.0 TO GPIO.3 SET AS DIGITAL
OPTION_REG = 0 ' WEAK PULLUPS ENABLED
' GP2/INT on falling edge
TRISIO = %00000100 ' GPIO.2 SET AS INPUT
GPIO = 0
N VAR BYTE ' VARIABLE N DEFINED
ON INTERRUPT GOTO WAIT_int
INTCON = %10010000 ' INTERRUPT ENABLED
' *************************************************************
START:
TOGGLE GPIO.0
FOR N=0 TO 250
pauseus 1000
NEXT
GOTO START
DISABLE
WAIT_INT:
TOGGLE GPIO.1
INTCON.1=0 ' Clear GP2/INT flag
RESUME
ENABLE
END
Last edited by mister_e; - 9th April 2008 at 04:10.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks