DSPRelated.com
Forums

clearing the serial inputbuffer

Started by ashefi January 20, 2006
hi all!

i have a little problem with async communication.
i am connecting a sampling device into com1 and reading it.
after 17 or 18 reading cycles the input buffer have more samples
than i asked for.
in the first 16/17 cycles it gives good results.

if i do (s=serial('com1')):
fclose(s);
fopen(s);
it solves the problem, but it is making a delay of 1-2 seconds while
the 16/17 sampling cycles are 0.5-1 second.

i have noticed that the ValuesReceived on the 17/18 cycle (and so
on) are more than i asked for.

does anyone know how can i clean the serial inputbuffer?

thatnks ahaead, Amit Shefi.