how can i clean the buffer?

05 May 2011

Hi everyone! I'm working with the serial port and i have some problemes, basicly i need to clean the buffer after the data transmitions and i don't know how can i do it. I already searched about that, but I'm not finding nothing... someone can help me?

tks, Adriana

06 May 2011

Not sure how far you've looked but you should check out Andy Kirkham's MODSERIAL class. It has buffer flushing methods.

06 May 2011

The part I don't understand is i need to clean the buffer after the data transmitions. If all data has been transmitted the buffer is empty. So flushing it will make no difference. Can you give us some more details about what you are trying to achieve?

06 May 2011

hi,

i know Andy, but in my program i don't send usualy the same type thing. the PC sends to the mbed something that defines what is need to send... and that can change while the program runs. and each time that i change what i want to send, i'm also finishing the communication. but when i finish the communication, some data stays at the buffer, bacause they was not send yet. and when i restart the communications is sent the old data that are in the buffer and not the new data. so, i need to clean the buffer...

tks henry, i'm seeing this!