dnf roaringwild

小弟第一次学习做串口通讯,不知道如何下手,请各位高手引小弟入门!谢谢!
是这样的,我想做一个串口通讯的小程序。在FORM上放置一个Timer,每隔1秒同时从Com1和Com5读取数据,然后分别追加写到1.txt和2.txt文件里去。
我的电脑是笔记本,其中Com1是自带的标准串口,而Com5是通过PCMCIA卡扩充的,Windows把它认为Com5。我用“超级终端”测试串口时,发现读取Com1的内容形式是“$gpvtg,n12.3,12.345N,32.165E,2.3,1”,Com5的内容形式是“$D,33.34”,那么我自己的程序读取这两个串口时,读出的会是什么样的内容呢?是二进制码还是ASCII码呢?另外我想用一些好的VCL控件来实现串口操作,不知道有什么好的控件,能在BCB6下可用?
能不能给个例子,多谢了!
串口通讯参见:
http://www.csdn.net/expert/topic/853/853481.xml?temp=.6689264
给你个网站,专门作串口通讯
http://roaringwind./scomm
http://www.csdn.net/expert/topic/834/834923.xml?temp=.4513666
lj_csdn(大笨蛋)&代码已经收藏,呵呵。。。。不过我希望能用控件来完成,这样可以少动点脑筋,因为我无须花时间去研究串口通讯,只要会一些简单的就行了。
hbxtx(xy)&推荐的网站不错,谢谢。
begin&644&yb_comm.part01.rar
hIa3m6Fc5+3diQl2-1E+++++++++9dbHUU0Q++++++++++++0+++++BmSvGkI
hA+Q+2++++3Z0LoBDHIqWa5EUU1A+0+I++BQC+++07Aw1FxqYvGkRBFA+U+++
h+3Z0LoBDHIpQSK7TMqxhPGtWQ4ib41k48hPx855h0N0lMiTPpUs5CNtLkljA
huudjA6XkmILVlp5XWrBoHsNJkMRAnWq+mV0wD3qUq3NxsFH3xgSsN4VOlZ92
hLZdn8GkmBAq+zJpG9NZNsxFoWDAtfVrusT-ZX3Iex0yuCMBNUMLEzXgZ49fS
hQpI0e5o+b--TVl17y-3WIecHb4gOiuZTimSepZi1qcfeUPWc+xy7Y3nQUmkp
hc6d9LpmIlFlR89CIH2jan0t+1vifhEM3lRVoZG1SvATo68T2+M2MO-6OPm8+
hNvV+YYLi608arElBa3BmBFJqItHUU1yeO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10l5l6-pLpUwlQ4ehg-jZjtjGqjXX86Kv2-C
h9AP+gmqcJYslOVw+AycP1I6yZPIp5H-aMXHWlo0rblCHc2zXp--
hxW6Jo5aQqo91Lyn8kOOgqW6UOLPLXP6QqTGPr7hvga9zlZxVPXJrduCsVkb+
h87VNr2AR74qbKzZJw0Kjc4BJK5Vljfjt0Z3hdPfXBgRj++0zW4TqeTzIEwxo
h66+r+9s+++1M+E+++YmgTYB6dCog5HIL+6++++-NEZx1HopBL5ZWLqBjPKpT
hQaJn9b7ZQuQM++DTewSYtoGNtTe4jUmg9LVhb8yzBbEeRMMm92OdU2ke-GfS
hd0FLgabMLILb6bOsNsyaWEwpbp3xEypj8l29QExHwfHKOcunIoCBq63KjtJf
hLPyBKT-9H2Z6KliWD9RZA1SgpXhYtc66qlHdcFKW+ZbfPfbyH4fcVq3oWInP
h7fRBEdqGvdxL4OJwPZF+z9g50DDMdjwJ76Cjj65kMQcs6jGslxfIiZ8izBf2
MJhRtEqGRji6++9y6NzOdzxH2DLg+E+Q+
sum&-r/size&
以上两个帖子是我自己编的控件的源代码,直接打开&yb_comm.bpk&编译***
这个&BCB&6.0&版本的
把以上两个帖子保存分别到两个文本文件,扩展名为&.xxe
用&WinRAR&3.0&解码、解压缩,得到源程序代码所有的文件
有什么问题再一起探讨
如果你对控件有所改进或修改,请给我一个&EMail&或其他任何方法让我知道
可以这样打开串口
//---------------------------------------------------------------------------
&&&&&YBComm321-&PortNo&=&2;&//COM2
&&&&&YBComm321-&Active&=&
&&catch(Exception&&e)
&&&&&Application-&MessageBox(e.Message.c_str(),"错误信息",MB_OK|MB_ICONSTOP);
&&&&&Application-&Terminate();
在串口事件接收数据
//---------------------------------------------------------------------------
void&__fastcall&TForm1::YBComm321CommNotify(TObject&*Sender,&int&NotifyType)
&&if(NotifyType&&&EV_RXCHAR)&//接收到数据
&&&&&char&Buffer[128];
&&&&&int&n&=&YBComm321-&Read(Buffer,120);&//读到&n&个字节,n&&=&120
&&&&&while(n)&//如果缓存的数据比&120&多,需要一直读到没有为止
&&&&&&&&Buffer[n]=0;
&&&&&&&&Memo1-&Text&=&Memo1-&Text&+&B
&&&&&&&&n&=&YBComm321-&Read(Buffer,120);&//读到&n&个字节,n&&=&120
也可以查询数据
//---------------------------------------------------------------------------
void&__fastcall&TForm1::Timer1Timer(TObject&*Sender)
&&char&Buffer[128];
&&int&n&=&YBComm321-&Read(Buffer,120);&//读到&n&个字节,n&&=&120
&&while(n)&//如果缓存的数据比&120&多,需要一直读到没有为止
&&&&&Buffer[n]=0;
&&&&&Memo1-&Text&=&Memo1-&Text&+&B
&&&&&n&=&YBComm321-&Read(Buffer,120);&//读到&n&个字节,n&&=&120
//---------------------------------------------------------------------------
void&__fastcall&TForm1::Button1Click(TObject&*Sender)
&&YBComm321-&Write(Memo2-&Text.c_str(),&Memo2-&Text.Length());
//---------------------------------------------------------------------------
控件说明:
Active:&打开、关闭串口,也得到当前串口是否打开了
&&true&&=&打开
&&false&=&关闭
PortNo:&整数值
&&1&代表&COM1
&&2&代表&COM2
&&n&代表&COMn
Baud&的值:&根据需要修改
&&CBR_110& CBR_19200
&&CBR_300& CBR_38400
&&CBR_600& CBR_56000
&&CBR_1200 CBR_57600
&&CBR_2400 CBR_115200
&&CBR_4800 CBR_128000
&&CBR_9600 CBR_256000
&&CBR_14400
Parity&(奇偶校验)的值:&一般用默认值
&&EVENPARITY&&&&偶
&&MARKPARITY&&&&Mark
&&NOPARITY&&&&&&无奇偶校验&(默认值)
&&ODDPARITY &&&&奇
StopBits&(停止位)的值:&一般用默认值
&&ONESTOPBIT&&&&1&位&(默认值)
&&ONE5STOPBITS&&1.5&位
&&TWOSTOPBITS&&&2&位
FlowControl&(数据流控):
一般无&MODEM&用默认的&fcNone
有&MODEM&不能选择&fcNone
&&fcNone&&&&&&&&&&=&0,&(默认值)
&&fcRtsCts&&&&&&&&=&3,
&&fcXonXoff&&&&&&&=&4,
&&fcTranXonXoff&&&=&5,
&&fcRtsCtsXonXoff&=&6,
AutoAnswer&(自动应答):
使用&MODEM&硬件本身的自动应答功能
取值范围&0&-&255
&&0&不自动应答
&&1&-&255&表示***响铃&AutoAnswer&次数后应答
InitModem()&初始化&MODEM
&&如果有&MODEM&需要在&AfterOpen&事件&(每次&Active&之后)&调用这个方法
long&__fastcall&Read(void&far&*s,&long&n);
&&读串口数据到地址&s,最多读&n&个字节
&&返回值为实际读到的字节数
long&__fastcall&Write(const&void&far&*s,&long&n);
&&把地址&s&的数据写到串口发送出去,发送&n&个字节
&&返回值为实际发送出去的字节数
void&__fastcall&PurgeRead(bool&bAbort=false);
&&清除读缓存,如果&bAbort&为&true,会强制中断当前正在进行的读操作
void&__fastcall&PurgeWrite(bool&bAbort=false);
&&清除写缓存,如果&bAbort&为&true,会强制中断当前正在进行的写操作
抛出的异常为&EComm32Error,&由&Exception&继承
&&EComm32Error&有&ErrorCode&属性,可以判断错误类型,详见&.h&文件
回复
即使是一小步也想与你分享

参考资料

 

随机推荐