Hi,
I have the following code below where every once in a while I'm checking the incoming data using SERIN2. If I change the WAIT-TIME in SERIN2 from 5mS to 4mS or less the USB connection would get lost and disconnected intermittently. When I use a 5mS for WAIT-TIME the program is very stable. The length of the SERIN2 incoming package is 3.6mS. Any idea why is this happening? Should I increase that 5mS to 7 or 8mS? I believe that the USBSERVICE should be done every 10 milli seconds or less, is this correct? Is there a better way to do what I'm trying to accomplish?
Thanks,
Robert
Code:
FOR J = 0 TO 7
USBSERVICE
GOSUB SearchForClockSignal
USBSERVICE
IF ClockSignalFound = 1 THEN EXIT 'EXITS THE LOOP IF A CLOCK SIGNAL WAS RECEIVED
NEXT J
SearchForClockSignal:
USBSERVICE
SERIN2 PORTB.7, 32, 5, CLOCKSEARCHFAILED, [STR RFID_IN\7]
USBSERVICE
ClockSignalFound = 1 'SETS FLAG TO STOP SEARCH
CLOCKSEARCHFAILED:
return
Bookmarks