How do one use a interrupt with the SERIN function? Basically what I'm trying to accomplish is to have a blinking LED and an interrupt on porta.5 - where I retrive a byte and then continue with the main loop.
Currently my code isn't working as expected. It seems that the interrupt doesn't resume the main program loop after SERIN.
I'm compiling for pic12f629.
btw, to be able to do multitasking (updating LEDS and receiving from serial port) do I need to use interrupts?
Code:
INCLUDE "modedefs.bas" 'For the Baud Rate modes
char var byte
ON INTERRUPT GOTO myint ' Interrupt handler is myint
INTCON.3 = 1 'PORTA change interupt enabled
INTCON.7 = 1 'Global interrupt enabled
IOC.3 = 1
led_on:
high porta.0
pause 500
low porta.0
pause 500
goto led_on
' Interrupt handler
DISABLE ' Disable interrupts in handler
myint:
SerIN PORTA.3, T9600, ["b"],char ' Will be uesed later
INTCON.0 = 0 'Clear GPIF
RESUME ' Return to main program
ENABLE ' Enable interrupts after handler
End
Bookmarks