I'm having difficulty clearing out framing errors that happen when my laptop (controlling my circuitry) comes out of sleep mode.
My application has a tight loop looking for a received character. I use the timeout feature to look for any usart error or poll user inputs via switches. What happens is all is working fine but when I put the laptop to sleep I get framing errors when I come out of sleep UNTIL a valid character is received by the USART.
I'm using PBP and 18F252
My code is basically:
RXLOOP:
HSERIN 10,NOCHR,[ChrIn]
Goto RXLOOP
NOCHR:
IF RCSTA.1 =1 then 'Framing Error Detected
RCSTA.7 = 0 'Disable the USART
RCSTA.7 = 1 'Re-Enable USART
PulsOut PortC.2,10 'Issue a pulse to see what's happeing
' used for debugging this problem
endif
goto RXLOOP
What happens is when the laptop begins to come up from "StandBy" mode, I get a continuous stream of pulses indicating to me that the framing error has not be cleared. As soon as I transmit a valid character, the pulse stream stops.
I've also tried reading the Rx Buffer and trashing it but that still didn't reset the error condition.
Any help would be greatly appreciated.
Thanks..chris
Bookmarks