使用COM端口发送和接收串行(UART)数据的C程序 [英] C program to send and receive serial(UART) data using COM ports

查看:43
本文介绍了使用COM端口发送和接收串行(UART)数据的C程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用串行端口的 C 代码在嵌入式设备和我的 PC 之间进行通信.

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

任何人都可以建议我如何在 Windows 环境(Windows7 或 Windows8 64 位)中使用计算机的 COM 端口发送和接收串行或 UART 数据.

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

推荐答案

要连接到 COM 端口,请使用 CreateFile():

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

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

然后使用 ReadFile() 或 WriteFile() 访问端口.

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

这篇关于使用COM端口发送和接收串行(UART)数据的C程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆