I'm not having a good day with manual 2
It says...HINTSETUP mask
- mask is a variable/constant which defines which interrupt pins to activate.
Bit 7 - reserved
Bit 6 - Interrupt 2 Trigger (0 = rising edge, 1 = falling edge)
Bit 5 - Interrupt 1 Trigger (0 = rising edge, 1 = falling edge)
Bit 4 - Interrupt 0 Trigger (0 = rising edge, 1 = falling edge)
Bit 3 - reserved
Bit 2 - Interrupt 2 Enable
Bit 1 - Interrupt 1 Enable
Bit 0 - Interrupt 0 Enable (not 20X2)
I'm pretty convinced that the 'triggers' are the wrong way round (and also re-inforced by BB on http://www.picaxeforum.co.uk/showpost.php?p=102100&postcount=6) although not noted as a manual error
I've got some code that has a normally high signal on B.0 (hint0) and I want an interrupt when it transitions low (and it stays low until I reset it - yet to do)
With HINTSETUP %00010001 nothing happens, but with HINTSETUP %00000001 is works fine. Here's an extract of the output ... and the code follows
It says...HINTSETUP mask
- mask is a variable/constant which defines which interrupt pins to activate.
Bit 7 - reserved
Bit 6 - Interrupt 2 Trigger (0 = rising edge, 1 = falling edge)
Bit 5 - Interrupt 1 Trigger (0 = rising edge, 1 = falling edge)
Bit 4 - Interrupt 0 Trigger (0 = rising edge, 1 = falling edge)
Bit 3 - reserved
Bit 2 - Interrupt 2 Enable
Bit 1 - Interrupt 1 Enable
Bit 0 - Interrupt 0 Enable (not 20X2)
I'm pretty convinced that the 'triggers' are the wrong way round (and also re-inforced by BB on http://www.picaxeforum.co.uk/showpost.php?p=102100&postcount=6) although not noted as a manual error
I've got some code that has a normally high signal on B.0 (hint0) and I want an interrupt when it transitions low (and it stays low until I reset it - yet to do)
With HINTSETUP %00010001 nothing happens, but with HINTSETUP %00000001 is works fine. Here's an extract of the output ... and the code follows
Code:
started...
In main, pinsB = 1 hint0flag = 0
In main, pinsB = 1 hint0flag = 0
In interrupt, pinsB = 0 hint0flag = 1
In main, pinsB = 0 hint0flag = 0
In main, pinsB = 0 hint0flag = 0
Code:
#picaxe 28x2
#no_table
setfreq em32
hintsetup %00000001 ;hint0 (pin B.0 - leg 21) trigger = falling edge and hint0 enabled
;but manual says it should be hintsetup %00010001
setintflags %00000001,%00000001 ; interrupt on INT0
pause 1000 ;wait for F8 terminal window
sertxd ("started...", CR, LF)
main:
b0 = pinsB
sertxd ("In main, pinsB = ", #b0, " hint0flag = ", #hint0flag, CR, LF)
pause 4000
goto main
interrupt:
b0 = pinsB
sertxd ("In interrupt, pinsB = ", #b0, " hint0flag = ", #hint0flag, CR, LF)
hint0flag=0 ;clear the hint0 interrupt flag
setintflags %00000001,%00000001 ;reset intflags to interrupt on INT0
return