Many thanks Darrel.
I have a problemetette - my program runs fine, but then when I press a switch (to generate an IOC), an interrupt *is* triggered, but it then seems to loop in my interrupt handler (it's actually becuase the INTCON.0 bit seems to be staying at 1, which keeps it jumping to the interrupt handler constantly)
Any ideas, why the IOC_FLAG = 0 entry towards the end of the interrupt handler doesn't appear to be taking affect?
Code:IOC_FLAG VAR INTCON.0 ' Alias RABIF interrupt flag bit debug_out var byte SW1 VAR PORTA.5 on_status var byte Green_LED VAR PortC.1 ASM INT_LIST macro ; IntSource, Label, Type, ResetFlag? INT_Handler IOC_INT, _Switch_Interrupt, PBP, YES endm INT_CREATE ; Creates the interrupt processor ENDASM Check: 'Check switches before enabling/re-enabling IOC WHILE SW1 = 0 : WEND ' Wait until all switch inputs = 1 IOC_FLAG = 0 ' Clear the int-on-change flag bit @ INT_ENABLE IOC_INT ; Enable 'Int On Change' interrupts on_status = 0 Low GREEN_LED '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Switch_Interrupt: hserout ["trap ", dec IOC_FLAG, 13, 10] @ INT_DISABLE IOC_INT ; Disable further IOC interrupts pause 10 IF sw1 = 0 THEN if on_status = 1 then on_status =0 Low GREEN_LED else High GREEN_LED on_status =1 endif endif pause 20 WHILE SW1 = 0 : WEND pause 25 IOC_FLAG = 0 @ INT_ENABLE IOC_INT @ INT_RETURN
This is almost certainly something I'm doing wrong, but then again, it's pretty much a direct what was working fine my functioning 16F690 IOC routine?




Bookmarks