⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.~cpp

📁 C++BUILDER 模仿RS232 設備發出XONXOFF 軟體流量控制訊號,含源碼 可更該Baudrate 基本為7.E.2
💻 ~CPP
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "Comm"
#pragma link "YbCommDevice"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
YbCommDevice1->Active=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
 String aa=char(17) ;
YbCommDevice1->Write(aa.c_str(),1)  ;

}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button6Click(TObject *Sender)
{
if (ComboBox2->ItemIndex==0)



            YbCommDevice1->Baud=TYbCommDevice::br300;
        if (ComboBox2->ItemIndex==1)
         YbCommDevice1->Baud=TYbCommDevice::br600;
        if (ComboBox2->ItemIndex==2)
      YbCommDevice1->Baud=TYbCommDevice::br1200;
        if (ComboBox2->ItemIndex==3)
  YbCommDevice1->Baud=TYbCommDevice::br2400;
        if (ComboBox2->ItemIndex==4)
      YbCommDevice1->Baud=TYbCommDevice::br4800;
        if (ComboBox2->ItemIndex==5)
      YbCommDevice1->Baud=TYbCommDevice::br9600;
        if (ComboBox2->ItemIndex==6)
     YbCommDevice1->Baud=TYbCommDevice::br19200;
        if (ComboBox2->ItemIndex==7)
       YbCommDevice1->Baud=TYbCommDevice::br38400;
        if (ComboBox2->ItemIndex==8)
     YbCommDevice1->Baud=TYbCommDevice::br57600;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
 String aa=char(19) ;
YbCommDevice1->Write(aa.c_str(),1)  ;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
 String aa=char(17) ;
 String bb=char(19) ;
YbCommDevice1->Write(aa.c_str(),1)  ;
Sleep(3);
YbCommDevice1->Write(bb.c_str(),1)  ;


}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click(TObject *Sender)
{
 String aa=char(19) ;
 String bb=char(17) ;
YbCommDevice1->Write(aa.c_str(),1)  ;
Sleep(1);
YbCommDevice1->Write(bb.c_str(),1)  ;
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -