how to clear serial buffer?

拜拜、爱过 提交于 2020-02-25 05:19:40

问题



I am receiving messages over serial port from a micro-controller. i am using a baud rate of 9600. I have a program written using win32 API that receives the messages. Sometimes it happens that i am not able to receive the messages and then suddenly a burst comes in when i press Ctrl+C.
How do I clear the serial buffer so that i can avoid this flooding of data?

Thank you


回答1:


The PurgeComm function does that.

When using serial ports in Windows, the Comm Port API reference is quite useful.



来源:https://stackoverflow.com/questions/5453205/how-to-clear-serial-buffer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!