Hi again, I have been trying to play around with interrupts, both instant asm (which barely makes any sense to me) & basic 'on interrupt'.
I have wrote a very basic code, however what I cant get my head around is how to incorporate the button method we discussed before into an interrupt? So how can one push & release of the button enter an interrupt loop & wait there, until I push & release the button again which would exit back to the main loop? Here is the small code I have written.
Thanks again,
Rob
Code:
ANSEL = 0 'digital I/O
CMCON0 = 7 'comparator off
INTCON = %00010000 'enable pin 4 interrupt
TRISIO = %00010000 'pin 4 input
LED VAR GPIO.0 'pin 7 led
Switch VAR GPIO.4 'pin 3 button
ON INTERRUPT GOTO int1
main:
HIGH LED
PAUSE 500
LOW LED
PAUSE 500
GOTO main
DISABLE
int1:
TOGGLE LED
INTCON.1 = 0
RESUME
ENABLE
Bookmarks