Quote Originally Posted by Wilbert Ingels View Post
If i look in the manuel on page 135 (serin2) "if the serial input pin stays in the idle state during the timeout time, the program will exit the SERIN2 command and jump to label". In my case, the input pin doesn't stay idle because it received one glitch ...
The fix might be something as simple as:
Code:
loop:
datagood = 0
SERIN2 (((your code here with the shortest timeout possible, timeoutlabel, etc.etc....)))
datagood = 1
goto overtimeoutlabel
timeoutlabel: if datagood = 0 then goto loop  'data was bad, try again
overtimeoutlabel: continue code here....
if it does glitch, you check 'datagood'. If datagood is 0, then it glitched or didn't receive what you wanted and try again

Aside from that, I agree with the other guys, ya gotta find the root cause of the glitches...