I've done a few things with the PICAXE and have had some success. When things don't work, break it down into the basics and work through it...this is the first time I've tried to use an interrupt, but it made sense and I can't get it to work. So I simplified it and it still doesn't work.
Here's the simple version (on a 14M2):
setint %00000001,%00000000,C ; interrupt when pinC.0 goes low
main: low B.3 ; switch output B.3 OFF
pause 2000 ; wait 2 seconds
serTXD("MAIN")
goto main ; loop back to start
interrupt: high B.3 ; switch output B.1 ON
pause 2000 ; wait 2 seconds
serTXD("Interrupt")
setint %00000001,%00000000,C ; re-activate interrupt
return ; return from sub
This is straight from the example on the Wiki, with the pins changed. I expect that when I push the button that pulls C.0 low the LED on B.3 will turn on. The terminal gives me the MAIN message but never the Interrupt message.
What the heck am I doing wrong?
Here's the simple version (on a 14M2):
setint %00000001,%00000000,C ; interrupt when pinC.0 goes low
main: low B.3 ; switch output B.3 OFF
pause 2000 ; wait 2 seconds
serTXD("MAIN")
goto main ; loop back to start
interrupt: high B.3 ; switch output B.1 ON
pause 2000 ; wait 2 seconds
serTXD("Interrupt")
setint %00000001,%00000000,C ; re-activate interrupt
return ; return from sub
This is straight from the example on the Wiki, with the pins changed. I expect that when I push the button that pulls C.0 low the LED on B.3 will turn on. The terminal gives me the MAIN message but never the Interrupt message.
What the heck am I doing wrong?