Hi Chris,
Framing errors are normally caused by serial data coming in at the wrong baud rate or noise. Your pulse is causing a logic 0 to be seen where the hardware USART expects to see the stop bit.
If you add a framing error test & a solution to clear it, then you shouldn't see the continuous pulse stream.
Unless you have an ongoing problem with noise pulses or a baud rate missmatch, this should clear the problem, and you should only see the single pulse on entry into the framing error test routine.
Code:
ChrIn VAR BYTE
Junk VAR BYTE
RXLOOP:
HSERIN 10,NOCHR,[ChrIn]
GOTO RXLOOP
NOCHR:
' Test for & clear framing error
IF FERR THEN ' IF RCSTA.2 = 1
Junk = RCREG ' Read RCREG to clear error
PulsOut PortC.2,10 ' Pulse to see what's happening
ENDIF
GOTO RXLOOP
You can test other conditions pretty much the same;
Code:
' Test for & clear overrun
IF OERR THEN ' Test OERR for overrun condition
CREN = 0 ' Disable receive
CREN = 1 ' Re-enable & clear OERR flag
ENDIF
' Test for & clear remaining data in buffer
WHILE RCIF ' Trash left over characters in RCREG
Junk = RCREG
WEND
GOTO RXLOOP
Bookmarks