RS232 Clearing Buffer???

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times
Contact:

RS232 Clearing Buffer???

Post by cobra1 »

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??

User avatar
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???

Post by Benj »

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.

Post Reply