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

📄 readwritecom.pas

📁 Delphi采用MSComm控件开发串口测试工具,在Windows+Delphi7编译通过
💻 PAS
字号:
unit ReadWriteCom;

interface

//------------------------------------------------------------------------------
      procedure SendToCom1(command : string);
      procedure SendToCom2(command : string);
      procedure SendToCom3(command : string);
      procedure SendToCom4(command : string);
//------------------------------------------------------------------------------

implementation
uses Windows, Dialogs, MainFrm;
//--------------------------Com1实现--------------------------------------------
procedure SendToCom1(command : string);
begin
     if Form1.MSComm1.PortOpen then
     begin
        Form1.MSComm1.Output := OleVariant(command);
     end
     else
        ShowMessage('Com1未打开');
end;

//--------------------------Com2实现--------------------------------------------
procedure SendToCom2(command : string);
begin
     if Form1.MSComm2.PortOpen then
     begin
          Form1.MSComm2.Output := OleVariant(command);
     end
     else
          ShowMessage('Com2未打开');
end;
//------------------------------------------------------------------------------
procedure SendToCom3(command : string);
begin
     if Form1.MSComm3.PortOpen then
     begin
          Form1.MSComm3.Output := OleVariant(command);
     end
     else
          ShowMessage('Com3未打开');
end;
//------------------------------------------------------------------------------
procedure SendToCom4(command :string);
begin
     if Form1.MSComm4.PortOpen then
     begin
         Form1.MSComm4.Output := OleVariant(command);
     end
     else
         ShowMessage('Com4未打开');
end;
//------------------------------------------------------------------------------
end.

⌨️ 快捷键说明

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