Despite being a a moderately experienced PIC assembler programmer I have started using PICAxes as I am impressed by their power and ease of use for complex functions.
I am however struggling with the following problem:
I wish to continuously monitor a pushbutton switch and am using the 'setint' command. The command works fine but is 'level' triggered rather than edge triggered. Thus on on return from interrupt if the switch is still pressed it calls the interrupt routine again !
(For hardware engineers (like myself) I want to implement a D-type edge triggered flip flop that toggles on negative edge.)
The manual says that I must clear the interrupt source in the interrupt routine but being a real world switch I cannot do this ?
Any ideas of how I coulddo this ?
Code Snippet below:
main:
setint %00000000, %000000010 'Enable Interrupt on PBSW input (Input 1 low)
'do main stuff here
goto main
interrupt: 'Subroutine called on PBSW closure
high LED 'Flash Test only
pause 100
low LED
setint %00000000, %000000010 'Re-enable interupt on Input1 low
return
I am however struggling with the following problem:
I wish to continuously monitor a pushbutton switch and am using the 'setint' command. The command works fine but is 'level' triggered rather than edge triggered. Thus on on return from interrupt if the switch is still pressed it calls the interrupt routine again !
(For hardware engineers (like myself) I want to implement a D-type edge triggered flip flop that toggles on negative edge.)
The manual says that I must clear the interrupt source in the interrupt routine but being a real world switch I cannot do this ?
Any ideas of how I coulddo this ?
Code Snippet below:
main:
setint %00000000, %000000010 'Enable Interrupt on PBSW input (Input 1 low)
'do main stuff here
goto main
interrupt: 'Subroutine called on PBSW closure
high LED 'Flash Test only
pause 100
low LED
setint %00000000, %000000010 'Re-enable interupt on Input1 low
return