VictorComm.v1.5.0.0.Full.Source.CBuilder12.ccrun
所属分类:通讯编程
开发工具:C++ Builder
文件大小:77KB
下载次数:42
上传日期:2008-11-21 17:10:21
上 传 者:
hunter898
说明: Victor 串口 VCL 控件, 简单实用, 功能强大的 C++ Builder 串口控件! 本控件是免费的, 不需要注册, 有关授权及许可协议详见 license.txt 文件
(Victor serial VCL controls, simple, practical, powerful C++ Builder serial control! This control is free, does not require registration, the authorization and license agreement see license.txt file)
文件列表:
ccrun.com.txt (990, 2008-11-18)
license.txt (2116, 2008-09-08)
Source\TVictorComm32.h (13223, 2008-09-08)
Source\TVictorCommPkg.h (7350, 2008-09-08)
Source\Unit_YBComm32_About.h (3131, 2008-09-05)
Source\Unit_YbCommDevice_Settings.h (6218, 2008-09-05)
Examples\SendPackage\Unit1.h (1198, 2008-09-08)
Examples\SendPkgOld\Unit1.h (1198, 2008-09-08)
Examples\SendBinary\Unit1.h (1202, 2008-09-08)
Examples\CommMcu\Unit1.h (1204, 2008-09-08)
Examples\SmpSendFile\Unit1.h (1214, 2008-09-08)
Examples\SmpBinary\Unit1.h (1220, 2008-09-08)
Examples\SendText\Unit1.h (1224, 2008-09-08)
Examples\ModemDial\Unit1.h (1471, 2008-09-08)
Examples\ModemDial\UnitDial.h (4525, 2008-09-08)
Examples\ModemDial\UnitHang.h (2063, 2008-09-08)
Examples\TestSendFile\UnitSendFile.h (1802, 2008-09-08)
Examples\TestSendFile\UnitTsData.h (1483, 2008-09-08)
Source\YbCommDesignEditors.h (944, 2008-09-05)
Source\YbCommDevice.h (14094, 2008-09-08)
Examples\CommMcu\Project1.cpp (1050, 2008-09-08)
Examples\SendBinary\Project1.cpp (1050, 2008-09-08)
Examples\SendPackage\Project1.cpp (1050, 2008-09-08)
Examples\SendPkgOld\Project1.cpp (1050, 2008-09-08)
Examples\SendText\Project1.cpp (1050, 2008-09-08)
Examples\SmpBinary\Project1.cpp (1050, 2008-09-08)
Examples\SmpSendFile\Project1.cpp (1050, 2008-09-08)
Examples\ModemDial\Project1.cpp (1275, 2008-09-08)
Examples\TestSendFile\TestSendFile.cpp (1063, 2008-09-08)
Source\TVictorComm32.cpp (36011, 2008-09-08)
Source\TVictorCommPkg.cpp (15878, 2008-09-08)
Source\Unit_YBComm32_About.cpp (8731, 2008-09-08)
Source\Unit_YbCommDevice_Settings.cpp (19690, 2008-09-05)
Examples\SendText\Unit1.cpp (2084, 2008-09-08)
Examples\SendBinary\Unit1.cpp (2295, 2008-09-08)
Examples\SmpBinary\Unit1.cpp (2409, 2008-09-08)
Examples\CommMcu\Unit1.cpp (2812, 2008-09-08)
Examples\ModemDial\Unit1.cpp (3510, 2008-09-08)
Examples\SmpSendFile\Unit1.cpp (4663, 2008-09-08)
... ...
Victor 串口 VCL 控件,版本 1.5.0.0 for C++ Builder 2009
C++爱好者: http://www.cppfans.com/
【软件简介】
简单实用, 功能强大的 C++ Builder 串口控件!
本控件是免费的, 不需要注册, 有关授权及许可协议详见 license.txt 文件。
1.支持二进制数据和文本数据的收发
2.支持任意格式的数据的收发
3.支持两种数据包协议(识别每帧数据首尾的方法):
①超时判断数据首尾, 适用于与单片机和仪表的通讯
②帧首尾和控制符, 适用于大量复杂的数据传输, 例如文件收发等
【控件特点】
1.完全由 C++ 代码写的, 支持简体中文, 繁体中文, 英文.
2.免费控件, 在主页上可提供示例程序和使用方法
3.免费升级, 如果控件版本升级, 在直接主页上下载新版本控件
使用简单:
用 控件->Active=true; 打开串口
控件->Read()读, 控件->Write()写.
可以处理控件的事件, 但不是必须的.
【控件安装方法】
1.在 C++ Builder 里面打开 VictorComm32.cbproj 工程,编译
2.在 C++ Builder 里面打开 VictorCommDesign.cbproj 工程,编译
3.安装编译生成的 VictorCommDesign.bpl 设计期控件包
注意:默认情况下,C++ Builder 编译生成的控件放在了
C:\Documents and Settings\All Users\Documents\RAD Studio\6.0\BPL
和 C:\Documents and Settings\All Users\Documents\RAD Studio\6.0\DCP
这两个文件夹里面
在使用上,C++ Builder 菜单: Project->Options->Directories/Conditionals
Include Path 和 Library Path 都要添上安装路径(包含*.h和*.lib的文件夹)
①Include Path 右面的“…”按钮,添加包含控件文件的文件夹
②Library Path 右面的“…”按钮,添加包含控件文件的文件夹
【简单应用】
打开串口:
try
{
YbCommDevice1->Active = true;
}
catch(Exception &e)
{
Application->MessageBox(e.Message.w_str(),"错误信息",MB_OK|MB_ICONSTOP);
}
写数据
YbCommDevice1->Write(任意数据的地址,字节数);
例如
int i=5;
YbCommDevice1->Write(&i,sizeof(int));
AnsiString s = "abc";
YbCommDevice1->Write(s.c_str(), s.Length());
读数据
实际读出字节数 = YbCommDevice1->Read(任意缓存地址,缓存容量);
【新功能:识别完整的数据帧】
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
YbCommDevice1->Active = true; //打开串口
YbCommDevice1->PackageType = cptFrameTimeout; //使用超时的方法识别每帧数据
YbCommDevice1->UsePackage = true; //启动 Package
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
char Buf[3];
Buf[0] = 0x99;
Buf[1] = 0x1b;
Buf[2] = 0x0d;
YbCommDevice1->WritePackage(Buf,3); //发送3个字节: 99 1B 0D
}
//---------------------------------------------------------------------------
void __fastcall TForm1::YbCommDevice1Package(TObject *Sender, int NotifyType)
{
unsigned char Buf[1000]; //接收缓存
int n = YbCommDevice1->ReadPackage(Buf,1000);
if(n>0) //收到数据的字节数
{
UnicodeString s;
for(int i=0; iLines->Add(s); //在 Memo1 里显示出收到的数据, 将会是完整的一帧数据
}
}
//---------------------------------------------------------------------------
谢谢您对Victor串口控件的支持!
欢迎到我的网站上讨论串口控件的问题!
---- Victor Chen
近期下载者:
相关文件:
收藏者: