资源简介
该代码是VS与串口之间通信的例子,C语言开发, 在该例子中,实现了 PC与通过串口与单片机之间的互通,供初学者参考

代码片段和文件信息
#include
#include
#include
#include
#include “serial.h“
using namespace std;
extern HANDLE hComm;
extern OVERLAPPED OverLapped;
extern COMSTAT Comstat;
extern DWORD dwCommEvents;
void initSerial()
{
if (OpenPort())
std::cout << “Open port success“ << std::endl;
if (SetupDCB(9600))//!!!!!!!!!!!!!!!!!!!此处更改波特率!!!!!!!!!!!!!!!!!!!!!!
std::cout << “Set DCB success“ << std::endl;
if (SetupTimeout(0 0 0 0 0))
std::cout << “Set timeout success“ << std::endl;
PurgeComm(hComm PURGE_RXCLEAR | PURGE_TXCLEAR | PURGE_RXABORT | PURGE_TXABORT);
}
int main()
{
initSerial();
while (1)
{
for (;;)
{
Sleep(1000);
WriteChar(“f“ 1);//可以自行设置分部发送
ReciveChar();
}
}
system(“pause“);
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 176718 2019-04-23 14:10 test2\Debug\main.obj
文件 183681 2019-04-23 14:06 test2\Debug\serial.obj
文件 1584 2019-04-23 14:11 test2\Debug\test2.log
文件 2886 2019-04-23 14:10 test2\Debug\test2.tlog\cl.command.1.tlog
文件 87136 2019-04-23 14:10 test2\Debug\test2.tlog\CL.read.1.tlog
文件 3140 2019-04-23 14:10 test2\Debug\test2.tlog\CL.write.1.tlog
文件 4226 2019-04-23 14:11 test2\Debug\test2.tlog\li
文件 4172 2019-04-23 14:11 test2\Debug\test2.tlog\li
文件 1036 2019-04-23 14:11 test2\Debug\test2.tlog\li
文件 254 2019-04-23 14:11 test2\Debug\test2.tlog\test2.lastbuildstate
文件 1387520 2019-04-23 14:10 test2\Debug\vc120.idb
文件 446464 2019-04-23 14:10 test2\Debug\vc120.pdb
文件 158760 2019-04-23 14:07 test2\Debug\源.obj
文件 848 2019-04-23 14:10 test2\main.cpp
文件 3896 2019-04-23 14:05 test2\serial.cpp
文件 479 2019-04-23 14:04 test2\serial.h
文件 4228 2019-04-23 14:06 test2\test2.vcxproj
文件 1241 2019-04-23 14:06 test2\test2.vcxproj.filters
文件 961 2017-08-11 00:20 test2.sln
目录 0 2019-04-23 14:11 test2\Debug\test2.tlog
目录 0 2019-04-23 14:10 test2\Debug
目录 0 2019-04-23 14:18 test2
----------- --------- ---------- ----- ----
2469230 22
相关资源
- 串口通讯技术实现--两台pc机通过串口
- C++语言编写串口调试助手
- GD32F103 在线串口Ymodem协议升级IAP
- ChartCtrl控件库(可在VS2019中使用)
- 最新的魔兽世界机器人脚本NpcBot.pat
- qt 串口助手源码
- 使用QWT库实现接收串口数据,并根据
- Qt5串口通信-windows
- 串口实验(接收与发送)
- vscode作为编辑器开发stm32f103c8
- 程序案例 利用LabVIEW实现串口通讯
- STM32(神舟III号 串口1发送实验程序)
- STM32429的串口收发程序
- PCA9539驱动程序
- stm32f103c8t6开发板原理图+pcb
- atmega128 串口通讯(RS485.c)
- arduino I2C设备扫描并串口返回地址(
- STM32 PCB封装库 全系列 全网不好找
- 串口调试助手(测试STM32串口)
- N76E003串口收发
- 获取pc上所有网卡信息
- C语言封装的HttpClient接口
- TCP/IP与串口调试
- vs2008 can总线通讯源码
- hook,捕获所有案件,查找所有窗口,
- (学习)VS2010之MFC入门到精通教程
- LabwindowsCVI 串口编程及事例.docx
- opc ua客户端
- 基于VSCode和CMake实现C++开发
- vc_串口通讯
评论
共有 条评论