Hi
Could someone please help me get my head round this small bit of interrupt code.
I don't understand this line "if pinC.7 = 1 then interrupt", when I run it on the simulator and pin C.7 is high the interrupt works and the code is stepped through right to the 'return' and then it repeats for as long as c.7 is active.
What I've read about "if pin" from the picaxe website I would have thought the interrupt, when activated would make C.4 high then on the next line if C.7 was still active it would jump back up to the start of the interrupt and keep repeating this, only going to the end of the interrupt when C.7 was 0?
The code:
Thanks for the help
John
Could someone please help me get my head round this small bit of interrupt code.
I don't understand this line "if pinC.7 = 1 then interrupt", when I run it on the simulator and pin C.7 is high the interrupt works and the code is stepped through right to the 'return' and then it repeats for as long as c.7 is active.
What I've read about "if pin" from the picaxe website I would have thought the interrupt, when activated would make C.4 high then on the next line if C.7 was still active it would jump back up to the start of the interrupt and keep repeating this, only going to the end of the interrupt when C.7 was 0?
The code:
Code:
interrupt:
[INDENT]high C.4 ; switch output C.4 on
if pinC.7 = 1 then interrupt ; loop here until the interrupt cleared
pause 2000 ; wait 2 seconds
setint %00000010,%00000010 ; re-activate interrupt
return ; return from sub[/INDENT]
John