c++builder、delphi是否直接提供了对于串口操作的控件或者函数

xz 2000-03-23 10:09:00
...全文
181 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
always 2000-03-24
  • 打赏
  • 举报
回复
我的朋友在c++builder中使用过一个串口读写控件,我想肯定有的。
下面是一段读写的代码:主程序中收发数据
void __fastcall TMainForm::fashu()
{
//TODO: Add your source code here
int i;
Comm1->Write(fahuan,m_nCount);
while(1){
i=Comm1->OutQueCount();
if(i==0)
break;
}
}


void __fastcall TMainForm::jieshu()
{
//TODO: Add your source code here
//TODO: Add your source code here
int nLen,k,i,nTimeOver,nCountTemp,nRetry=0;
bool bTm,bOver,bGroupOver=false;
unsigned char buf[1024];
nCountTemp=m_nCount;
while(!bOver){
bTm=false;
bOver=false;
m_nCount=0;
nTimeOver=0;
bGroupOver=false;
while(!bGroupOver){
nLen=Comm1->InQueCount();
if(nLen>0){
nTimeOver=0;
k=Comm1->Read(buf,512);
for(i=0;i<k;i++){
jiehuan[m_nCount]=buf[i];
=f((jiehuan[m_nCount]==0xff)&&(bTm==false)){
bOver=true;
return;
}
=f((bTm==false)&&(jiehuan[m_nCount]==touming)){
bTm=true;
continue;
}
m_nCount++;
bTm=false;
}
}
else{
Sleep(1000);
nTimeOver++;
if(nTimeOver>5){
bGroupOver=true;
}
}
}
nRetry++;
if(nRetry>=3){
bOver=true;
}
else{
m_nCount=nCountTemp;
fashu();
}
}
}

zyb 2000-03-24
  • 打赏
  • 举报
回复
MSCOMM32.ocx,SPCOMM等等
bitter 2000-03-24
  • 打赏
  • 举报
回复
www.delphi32.com
dengdeng 2000-03-24
  • 打赏
  • 举报
回复
好象没有,不过对串口编程不是很复杂。

对了,我有一个串口开发包,如有兴趣联系我。
sunsetyang 2000-03-23
  • 打赏
  • 举报
回复
你可以使用MsComm控件,是由微软提供的activex控件。可以在ActiveX的控件选项中添加。

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧