C program to send and receive serial(UART) data using COM ports

孤人 提交于 2021-01-29 15:03:04

问题


I want to communicate between an Embedded device and my PC using C codes for serial-port.

Anyone can suggest me how can I send and receive Serial or UART data using COM ports of my computer in Windows Environment(Windows7 or Windows8 64bit).

Please give me any link or any codes for suggestion ... Thanks ...


回答1:


To connect to the COM port, use CreateFile():

http://support.microsoft.com/kb/115831

Then use ReadFile() or WriteFile() to access the port.



来源:https://stackoverflow.com/questions/25013935/c-program-to-send-and-receive-serialuart-data-using-com-ports

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