Hi,
i am having a problem with the RS232, basically if i send data across to my PIC without the code actually receiving the character, it seems to sit there.
When i actually want the PIC to read the data sent to it, it reads the data that was sent to it before hand first,
Is there a way to wipe this "buffer" if thats what it is, so that it will only receive what i want it to when i want it to??
RS232 Clearing Buffer???
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: RS232 CLEARING BUFFER???
Hello,
The RS232 will buffer up to two bytes of data before generating an overflow error. The error and the two data bytes can be cleared by calling the receive byte macro. You could simply call two or three dummy RS232 reads when you are ready to receive data and this should clear the buffer. You could also use the receive interrupt to ensure you always read the byte's as they come in and then store in your own software buffer if and when you wish to receive the data.
The RS232 will buffer up to two bytes of data before generating an overflow error. The error and the two data bytes can be cleared by calling the receive byte macro. You could simply call two or three dummy RS232 reads when you are ready to receive data and this should clear the buffer. You could also use the receive interrupt to ensure you always read the byte's as they come in and then store in your own software buffer if and when you wish to receive the data.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel