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

📄 unitpublic.~pas

📁 很好用的串口通信工具软件。Comport目录下是用到的通信控件。
💻 ~PAS
字号:
unit UnitPublic;

interface
uses
  Windows, Messages, SysUtils, Variants, Classes,IniFiles;
type
  TByteSend = record
    StartByte:byte;
    EndByte:byte;
    CurByte:Byte;
    CurCount:integer;
    SendIntervel:integer;
    SendCount:integer;
    IsEnable:boolean;
  end;

var
  ByteSend:TByteSend;

procedure LoadByteSend;
Procedure SaveByteSend;
procedure IntSendByte;

implementation

procedure LoadByteSend;
var
  CurDir:string;
  iniF:TIniFile;
begin
  CurDir := GetCurrentDir + '\';
  iniF := TIniFile.Create(CurDir + 'CommHunter.ini');
  with ByteSend do
  begin
    StartByte:= strtointdef('$'+iniF.ReadString('循环发送字符','StartByte','00'),$00);
    EndByte:= strtointdef('$'+iniF.ReadString('循环发送字符','EndByte','FF'),$FF);
    SendIntervel:=inif.ReadInteger('循环发送字符','SendIntervel',500);
    SendCount:=inif.ReadInteger('循环发送字符','SendCount',1);
    IsEnable:=inif.ReadBool('循环发送字符','IsEnable',false);
  end;
end;
Procedure SaveByteSend;
var
  CurDir:string;
  iniF:TIniFile;
begin
  CurDir := GetCurrentDir + '\';
  iniF := TIniFile.Create(CurDir + 'CommHunter.ini');
  with ByteSend do
  begin
    iniF.WriteString('循环发送字符','StartByte',inttohex(StartByte,2));
    iniF.WriteString('循环发送字符','EndByte',inttohex(EndByte,2));
    inif.WriteInteger('循环发送字符','SendIntervel',SendIntervel);
    inif.WriteInteger('循环发送字符','SendCount',SendCount);
    inif.WriteBool('循环发送字符','IsEnable',IsEnable);
  end;
end;

procedure IntSendByte;
begin
  with ByteSend do
  begin
    ByteSend.CurByte := ByteSend.CurByte+1;
    if ByteSend.CurByte > ByteSend.EndByte then
    begin
      ByteSend.CurByte := ByteSend.StartByte ;
      ByteSend.CurCount := ByteSend.CurCount + 1;
      if ByteSend.CurCount >= ByteSend.SendCount then
      begin
        ByteSend.IsEnable :=false;
      end;
    end;
  end;
end;

end.

⌨️ 快捷键说明

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