StigOfTheDump
Senior Member
Hi
I have this code on a 40X2 that causes a hardware interrupt when one of 3 buttons (B.0, B.1 or B.2) is pressed. This sends a message to the AXE133Y to say that the program is interrupted, then when the button is released it carries on counting from where it left off.
I see the setintflags is one byte and has a bit for each button. Can I read this into a variable so that I could have a select case in the interrupt routine to tell me which button had been pressed, if it is not still pressed. Something along the lines of the commented out first line of my interrupt .
I have this code on a 40X2 that causes a hardware interrupt when one of 3 buttons (B.0, B.1 or B.2) is pressed. This sends a message to the AXE133Y to say that the program is interrupted, then when the button is released it carries on counting from where it left off.
I see the setintflags is one byte and has a bit for each button. Can I read this into a variable so that I could have a select case in the interrupt routine to tell me which button had been pressed, if it is not still pressed. Something along the lines of the commented out first line of my interrupt .
Code:
#picaxe 40x2
pullup %11111111
hintsetup %00000111
setint OR %00000000,%00000111,B
pause 500
serout A.4,N2400, (254,1)
pause 10
main:
for w1=0 to 65535
serout A.4,N2400, (254,128,#w1)
pause 10
next w1
serout A.4,N2400, (254,1)
goto main
blue:
serout A.4,N2400, (254,1)
pause 10
serout A.4,N2400, (254,128,"Blue")
pause 1000
serout A.4,N2400, (254,1)
pause 10
return
interrupt:
'if setintflags = %00000000,00000001,B then gosub blue
serout A.4,N2400, (254,1)
pause 10
serout A.4,N2400, (254,128,"Interrupted")
pause 1000
serout A.4,N2400, (254,1)
pause 10
setint OR %00000000,%00000111,B
return