串口通信 谁有TurboPower、spcomm、mscomm的控件啊?因为准备学串口通信,对这方面也不熟,所以希望各位能发些说明文档给我。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在项目中插入MSComm控件添加串口事件消息处理函数OnComm()void CSCommTestDlg::OnComm() { // TODO: Add your control notification handler code here }打开串口和设置串口参数CSCommTestDlg::OnInitDialog()// TODO: Add extra initialization hereif(m_ctrlComm.GetPortOpen())m_ctrlComm.SetPortOpen(FALSE);m_ctrlComm.SetCommPort(1); //选择com1if( !m_ctrlComm.GetPortOpen())m_ctrlComm.SetPortOpen(TRUE);//打开串口elseAfxMessageBox("cannot open serial port");m_ctrlComm.SetSettings("9600,n,8,1"); m_ctrlComm.SetInputMode(1); m_ctrlComm.SetRThreshold(1); m_ctrlComm.SetInputLen(0); m_ctrlComm.GetInput(); VC++ GDI+怎么种子填充 求助 0xC0150014 怎么修改socket 属性为Overlapped (非使用WSASocket) 如何在ATL服务中,启动对话框 组态软件开发QQ群 高手请进来看一看 如何在对话框应用程序上动态的建立一个菜单一个工具栏?用代码实现 网络下载问题大讨论 我的窗口怎么处理不了方向键消息? 有谁搞 AutoCAD 的吗?请教: 关于OnCreate 的问题 在vc(mfc)内如何使用vb脚本
添加串口事件消息处理函数OnComm()
void CSCommTestDlg::OnComm()
{
// TODO: Add your control notification handler code here
}打开串口和设置串口参数
CSCommTestDlg::OnInitDialog()
// TODO: Add extra initialization here
if(m_ctrlComm.GetPortOpen())
m_ctrlComm.SetPortOpen(FALSE);m_ctrlComm.SetCommPort(1); //选择com1
if( !m_ctrlComm.GetPortOpen())
m_ctrlComm.SetPortOpen(TRUE);//打开串口
else
AfxMessageBox("cannot open serial port");m_ctrlComm.SetSettings("9600,n,8,1");
m_ctrlComm.SetInputMode(1);
m_ctrlComm.SetRThreshold(1);
m_ctrlComm.SetInputLen(0);
m_ctrlComm.GetInput();