This program having SERIN2 working together with a USB connection keeps giving me headaches . The first code below works fine for many straight hours and days. However the second code gets hung up after half an hour or so. This SUB is called once every second more or less. Is there anything that I'm missing here? Why does the second code gets hung up after a while?
THIS CODE WORKS FINE:
Code:
SearchForClockSignal:
@ INT_DISABLE USB_INT
PIR2.5 = 0
SERIN2 PORTB.7, 32, 5, CLOCKSEARCHFAILED, [STR RFID_IN\7]
@ INT_ENABLE USB_INT
'.... SOME CODE HERE TO PROCESS THE DATA
CLOCKSEARCHFAILED:
@ INT_ENABLE USB_INT
RETURN
THIS CODE GETS HUNG UP AFTER A WHILE:
Code:
SearchForClockSignal:
@ INT_DISABLE USB_INT
PIR2.5 = 0
FOR J = 0 TO 5
SERIN2 PORTB.7, 32, 5, CONTINUESERIN2, [STR RFID_IN\7]
CONTINUESERIN2:
USBSERVICE
IF RFID_IN[0] = 252 THEN EXIT 'THE DATA PACKAGE WAS RECEIVED
NEXT J
@ INT_ENABLE USB_INT
'.... SOME CODE HERE TO PROCESS THE DATA
CLOCKSEARCHFAILED:
RETURN
Bookmarks