Totally agree.
I did a quick and dirty test to see if the WKP interrupts, should trigger when the switch is closed. My assumption is that the switch is connected up with a pull-up resistor, so it is high when the switch is open and low when it is closed… I used a large pushbutton I had sitting around and servo wire (that had the end removed off one end… I connected ground to one poll of the switch and the signal wire to other along with the plus through a 1K resistor… I then ran on quick test using a Bap28 (on an ABB) with the following code:
[code]fIntPending var bit
; Setup to use WKPINT for interrupts for
; for test will probably just use basic…
oninterrupt WKPINT_0, handle_WKP0
oninterrupt WKPINT_1, handle_WKP1
oninterrupt WKPINT_2, handle_WKP2
oninterrupt WKPINT_3, handle_WKP3
oninterrupt WKPINT_4, handle_WKP4
oninterrupt WKPINT_5, handle_WKP5
;----------------------------- Init System components ---------------------------------------
PMR5.bit0 = 1 ;enables pin as WKP interrupt instead of normal I/O
PMR5.bit1 = 1 ;enables pin as WKP interrupt instead of normal I/O
PMR5.bit2 = 1 ;enables pin as WKP interrupt instead of normal I/O
PMR5.bit3 = 1 ;enables pin as WKP interrupt instead of normal I/O
PMR5.bit4 = 1 ;enables pin as WKP interrupt instead of normal I/O
PMR5.bit5 = 1 ;enables pin as WKP interrupt instead of normal I/O
IEGR2.bit0 = 0 ;0 = Pin will interrupt on a falling edge, 1 to interrupt on a rising edge.
IEGR2.bit1 = 0 ;0 = Pin will interrupt on a falling edge, 1 to interrupt on a rising edge.
IEGR2.bit2 = 0 ;0 = Pin will interrupt on a falling edge, 1 to interrupt on a rising edge.
IEGR2.bit3 = 0 ;0 = Pin will interrupt on a falling edge, 1 to interrupt on a rising edge.
IEGR2.bit4 = 0 ;0 = Pin will interrupt on a falling edge, 1 to interrupt on a rising edge.
IEGR2.bit5 = 0 ;0 = Pin will interrupt on a falling edge, 1 to interrupt on a rising edge.
enable
sound p9, [50\4000, 50\4500, 50\5000]
pause 500
Main:
fIntPending = 1
enable WKPINT_0
sound p9, [50\4000]
while fIntPending
wend
pause 500
goto main
; simple interrupt handler to see when a contact switch hits the ground…
bWhichWKP var byte
Handle_WKP0:
bWhichWKP = 0
disable WKPINT_0
goto Handle_WKP
Handle_WKP1:
bWhichWKP = 1
disable WKPINT_1
goto Handle_WKP
Handle_WKP2:
bWhichWKP = 2
disable WKPINT_2
goto Handle_WKP
Handle_WKP3:
bWhichWKP = 3
disable WKPINT_3
goto Handle_WKP
Handle_WKP4:
bWhichWKP = 4
disable WKPINT_4
goto Handle_WKP
Handle_WKP5:
bWhichWKP = 5
disable WKPINT_5
Handle_WKP:
; simple one for now…
; serout cSSC_OUT, cSSC_BAUD, [0xA2] ; Tell the SSC to stop all servos - Requires special SSC firmware
serout s_out, i9600, "WKP: Contact Made ", dec bWhichWKP, 13];
sound P9, [50\3000+bWhichWKP*200]
fIntPending = 0
resume
[/code]
Note: I still had it set up for all of the WKP interrupts but only tested for 0… I got the beeps when I thought I should. So it will be interesting to see if the program I uploaded earlier detects the foot switches properly… I may try moving my switch to the CHR-3 and manually trying it to see. But now off to the bird house…
Kurt