Ttelmah
Joined: 11 Mar 2010 Posts: 19503
|
|
Posted: Sat Jan 29, 2011 7:47 am |
|
|
You are probably receiving characters while you are doing something else. Not handling them, so the internal UART buffer overflows. Only a couple of characters needed for this to happen. Once it does, the UART will hang until the error is cleared.
Enable the 'ERRORS' option in the #use RS232 declaration. One thing this does 'behind the scenes', is copy the error flag into a variable called 'RS232_ERRORS', and _automatically_ clear the error.
If you don't use the variable you will get a warning about the variable being unused (but this is just a warning, and doesn't matter at all), but the UART will remain operational if this happens.
ERRORS, really ought to be the default setting with the UART....
Another answer, use interrupt driven serial receive, and while stuff is arriving that you don't want, have this throw away received characters.
Best Wishes |
|