Hi,
I'm very new to the interrupts but I came across Darrel Taylor's instant interrupts and wanted to give it a try. So I tried his program to toggle the led with no problems (thanks Darrel). A pushbutton connected to RB0 (INTE) interrupts main loop and a LED toggles.
Code:
CMCON = 7 ' PortA = digital I/O
LED1 VAR PORTA.1
INCLUDE "DT_INTS-14.bas" ; Base Interrupt System
INCLUDE "ReEnterPBP.bas" ; Include if using PBP interrupts
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler INT_INT, _ToggleLED1, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
@ INT_ENABLE INT_INT ; enable external (INT) interrupts
Main:
@ sleep
GOTO Main
'---[INT - interrupt handler]---------------------------------------------------
ToggleLED1:
TOGGLE LED1
@ INT_RETURN
So now I'm feeling adventurous and wanted to try the interrupts on PortB (RBC_INT). Replaced INT_INT with RBC_INT and moved the switch to B1 but my LED won't toggle anymore when I push the switch (no interrupts)
Code:
CMCON = 7 ' PortA = digital I/O
LED1 VAR PORTA.1
INCLUDE "DT_INTS-14.bas" ; Base Interrupt System
INCLUDE "ReEnterPBP.bas" ; Include if using PBP interrupts
ASM
INT_LIST macro ; IntSource, Label, Type, ResetFlag?
INT_Handler RBC_INT, _ToggleLED1, PBP, yes
endm
INT_CREATE ; Creates the interrupt processor
ENDASM
@ INT_ENABLE RBC_INT ; enable external (INT) interrupts
Main:
@ sleep
GOTO Main
'---[INT - interrupt handler]---------------------------------------------------
ToggleLED1:
TOGGLE LED1
@ INT_RETURN
Am I supposed to do something else for RBC_INT?
Thanks,
Tom
Bookmarks