社区
ATL
帖子详情
operation valid only when the port is open
Dmeilin830
2009-11-25 01:46:39
我的程序是这样的,点击一个按钮后就关闭串口。可是出现上面这个错误。请教。在线等!!
...全文
423
4
打赏
收藏
operation valid only when the port is open
我的程序是这样的,点击一个按钮后就关闭串口。可是出现上面这个错误。请教。在线等!!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
蔓延
2011-06-10
打赏
举报
回复
CString str;
if(GetDlgItem(IDC_OPEN_COMM)->GetWindowText(str),str=="打开串口")
{/////////// 打开操作
GetDlgItem(IDC_OPEN_COMM)->SetWindowText("关闭串口");
if(m_ctrlComm.GetPortOpen()) // 打开了的话就先关再开
m_ctrlComm.SetPortOpen(TRUE);
m_ctrlComm.SetCommPort(3);//选择com3
if(!m_ctrlComm.GetPortOpen()) // 关了的话就再开
m_ctrlComm.SetPortOpen(TRUE);//打开串口
else
AfxMessageBox("不能打开串口");
m_hIconRed = AfxGetApp()->LoadIcon(IDI_ICON_RED);//打开红灯
m_ctrlIconOpenoff.SetIcon(m_hIconRed);
UpdateData(false);
}
else
{////////// 关闭操作
GetDlgItem(IDC_OPEN_COMM)->SetWindowText("打开串口");
m_ctrlComm.SetPortOpen(FALSE);
m_hIconGreen= AfxGetApp()->LoadIcon(IDI_ICON_GREEN);//打开绿灯
m_ctrlIconOpenoff.SetIcon(m_hIconGreen);
UpdateData(false);
}
/* if(m_ctrlComm.GetPortOpen()) // 打开了的话就先关再开
m_ctrlComm.SetPortOpen(FALSE);
m_ctrlComm.SetCommPort(3);//选择com3
if(!m_ctrlComm.GetPortOpen()) // 关了的话就再开
m_ctrlComm.SetPortOpen(TRUE);//打开串口
else
AfxMessageBox("不能打开串口");*/
m_ctrlComm.SetSettings("9600,n,8,1");//波特率9600,无校验,8个数据位,1 个停止位
m_ctrlComm.SetInputMode(1);//表示以2进制检取数据
m_ctrlComm.SetRThreshold(1);//参数1表示每当串口接收缓冲区有多于或等于1个字符时将引发一个接收数据的OnComm事件
m_ctrlComm.SetInputLen(0);//设置当前接收区数据长度为0
m_ctrlComm.GetInput();//先预读缓冲区以清除残留数据
这是代码
蔓延
2011-06-10
打赏
举报
回复
我的也是呀! 我一关闭串口就这样报!不知道是系统的原因还是程序的事!
Dmeilin830
2009-11-26
打赏
举报
回复
不是吧?没人回答啊??~~~~(>_<)~~~~
Dmeilin830
2009-11-25
打赏
举报
回复
void CCurrent::OnStop()
{
m_open=0;
AfxMessageBox("电机停止");
if(m_ctrlComm.GetPortOpen())
m_ctrlComm.SetPortOpen(FALSE);
m_strRXData="";
hexdata[102400]=0;
m_choose=-1;
UpdateData(FALSE);
}
计算机网络第六版答案
Since the queue grows when all the users are transmitting, the fraction of time during which the queue grows (which is equal to the probability that all three users are transmitting simultaneously)...
iOS crash only when NOT running via XCode
I suppose this appeared to work just fine when attached under the debugger only because I had zombies enabled, so the pointer I had was still
valid
. I should see if this is the reason it worked; if so
YOLOv5(PyTorch)实战:训练自己的数据集(Ubuntu)
YOLO系列是基于深度学习的端到端实时目标检测方法。 PyTorch版的YOLOv5轻量而性能高,更加灵活和易用,当前非常流行。 本课程将手把手地教大家使用labelImg标注和使用YOLOv5训练自己的数据集。...
-pie can only be used when targeting iOS 4.2 or later
网上下载的demo,执行报错-pie can only be used when targeting iOS 4.2 or later 解决的方法:选择target==》改动development Target改为8.1就可以 转载于:...
The Ephemeral
Port
Range (各操作系统随机端口范畴)
The Ephemeral
Port
Range A TCP/IPv4 connection consists of two endpoints, and each endpoint consists of an IP address and a
port
number. Therefore, when a client user connects to a server computer, ....
ATL
3,245
社区成员
48,539
社区内容
发帖
与我相关
我的任务
ATL
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
复制链接
扫一扫
分享
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章