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

📄 iniunit.~pas

📁 delphi实现的MODBUS主站程序
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
    property STATION8CODE: Integer read FSTATION8CODE write FSTATION8CODE;
    property STATION8OFFSET: Integer read FSTATION8OFFSET write FSTATION8OFFSET;
    property STATION8QUANTITY: Integer read FSTATION8QUANTITY write FSTATION8QUANTITY;

    {Section: STATION9}
    property STATION9ADDRESS: Integer read FSTATION9ADDRESS write FSTATION9ADDRESS;
    property STATION9CODE: Integer read FSTATION9CODE write FSTATION9CODE;
    property STATION9OFFSET: Integer read FSTATION9OFFSET write FSTATION9OFFSET;
    property STATION9QUANTITY: Integer read FSTATION9QUANTITY write FSTATION9QUANTITY;

    {Section: STATION10}
    property STATION10ADDRESS: Integer read FSTATION10ADDRESS write FSTATION10ADDRESS;
    property STATION10CODE: Integer read FSTATION10CODE write FSTATION10CODE;
    property STATION10OFFSET: Integer read FSTATION10OFFSET write FSTATION10OFFSET;
    property STATION10QUANTITY: Integer read FSTATION10QUANTITY write FSTATION10QUANTITY;

    {Section: STATION11}
    property STATION11ADDRESS: Integer read FSTATION11ADDRESS write FSTATION11ADDRESS;
    property STATION11CODE: Integer read FSTATION11CODE write FSTATION11CODE;
    property STATION11OFFSET: Integer read FSTATION11OFFSET write FSTATION11OFFSET;
    property STATION11QUANTITY: Integer read FSTATION11QUANTITY write FSTATION11QUANTITY;

    {Section: STATION12}
    property STATION12ADDRESS: Integer read FSTATION12ADDRESS write FSTATION12ADDRESS;
    property STATION12CODE: Integer read FSTATION12CODE write FSTATION12CODE;
    property STATION12OFFSET: Integer read FSTATION12OFFSET write FSTATION12OFFSET;
    property STATION12QUANTITY: Integer read FSTATION12QUANTITY write FSTATION12QUANTITY;

    {Section: STATION13}
    property STATION13ADDRESS: Integer read FSTATION13ADDRESS write FSTATION13ADDRESS;
    property STATION13CODE: Integer read FSTATION13CODE write FSTATION13CODE;
    property STATION13OFFSET: Integer read FSTATION13OFFSET write FSTATION13OFFSET;
    property STATION13QUANTITY: Integer read FSTATION13QUANTITY write FSTATION13QUANTITY;

    {Section: STATION14}
    property STATION14ADDRESS: Integer read FSTATION14ADDRESS write FSTATION14ADDRESS;
    property STATION14CODE: Integer read FSTATION14CODE write FSTATION14CODE;
    property STATION14OFFSET: Integer read FSTATION14OFFSET write FSTATION14OFFSET;
    property STATION14QUANTITY: Integer read FSTATION14QUANTITY write FSTATION14QUANTITY;

    {Section: STATION15}
    property STATION15ADDRESS: Integer read FSTATION15ADDRESS write FSTATION15ADDRESS;
    property STATION15CODE: Integer read FSTATION15CODE write FSTATION15CODE;
    property STATION15OFFSET: Integer read FSTATION15OFFSET write FSTATION15OFFSET;
    property STATION15QUANTITY: Integer read FSTATION15QUANTITY write FSTATION15QUANTITY;

    {Section: STATION16}
    property STATION16ADDRESS: Integer read FSTATION16ADDRESS write FSTATION16ADDRESS;
    property STATION16CODE: Integer read FSTATION16CODE write FSTATION16CODE;
    property STATION16OFFSET: Integer read FSTATION16OFFSET write FSTATION16OFFSET;
    property STATION16QUANTITY: Integer read FSTATION16QUANTITY write FSTATION16QUANTITY;
  end;

var
  IniOptions: TIniOptions = nil;

implementation

procedure TIniOptions.LoadSettings(Ini: TIniFile);
begin
  if Ini <> nil then
  begin
    {Section: SLAVECOUNT}
    FSLAVECOUNTCOUNT := Ini.ReadInteger(csIniSLAVECOUNTSection, csIniSLAVECOUNTCOUNT, 3);

    {Section: STATION1}
    FSTATION1ADDRESS := Ini.ReadInteger(csIniSTATION1Section, csIniSTATION1ADDRESS, 1);
    FSTATION1CODE := Ini.ReadInteger(csIniSTATION1Section, csIniSTATION1CODE, 4);
    FSTATION1OFFSET := Ini.ReadInteger(csIniSTATION1Section, csIniSTATION1OFFSET, 0);
    FSTATION1QUANTITY := Ini.ReadInteger(csIniSTATION1Section, csIniSTATION1QUANTITY, 8);

    {Section: STATION2}
    FSTATION2ADDRESS := Ini.ReadInteger(csIniSTATION2Section, csIniSTATION2ADDRESS, 2);
    FSTATION2CODE := Ini.ReadInteger(csIniSTATION2Section, csIniSTATION2CODE, 4);
    FSTATION2OFFSET := Ini.ReadInteger(csIniSTATION2Section, csIniSTATION2OFFSET, 0);
    FSTATION2QUANTITY := Ini.ReadInteger(csIniSTATION2Section, csIniSTATION2QUANTITY, 8);

    {Section: STATION3}
    FSTATION3ADDRESS := Ini.ReadInteger(csIniSTATION3Section, csIniSTATION3ADDRESS, 3);
    FSTATION3CODE := Ini.ReadInteger(csIniSTATION3Section, csIniSTATION3CODE, 4);
    FSTATION3OFFSET := Ini.ReadInteger(csIniSTATION3Section, csIniSTATION3OFFSET, 0);
    FSTATION3QUANTITY := Ini.ReadInteger(csIniSTATION3Section, csIniSTATION3QUANTITY, 8);

    {Section: STATION4}
    FSTATION4ADDRESS := Ini.ReadInteger(csIniSTATION4Section, csIniSTATION4ADDRESS, 4);
    FSTATION4CODE := Ini.ReadInteger(csIniSTATION4Section, csIniSTATION4CODE, 4);
    FSTATION4OFFSET := Ini.ReadInteger(csIniSTATION4Section, csIniSTATION4OFFSET, 0);
    FSTATION4QUANTITY := Ini.ReadInteger(csIniSTATION4Section, csIniSTATION4QUANTITY, 8);

    {Section: STATION5}
    FSTATION5ADDRESS := Ini.ReadInteger(csIniSTATION5Section, csIniSTATION5ADDRESS, 5);
    FSTATION5CODE := Ini.ReadInteger(csIniSTATION5Section, csIniSTATION5CODE, 4);
    FSTATION5OFFSET := Ini.ReadInteger(csIniSTATION5Section, csIniSTATION5OFFSET, 0);
    FSTATION5QUANTITY := Ini.ReadInteger(csIniSTATION5Section, csIniSTATION5QUANTITY, 8);

    {Section: STATION6}
    FSTATION6ADDRESS := Ini.ReadInteger(csIniSTATION6Section, csIniSTATION6ADDRESS, 6);
    FSTATION6CODE := Ini.ReadInteger(csIniSTATION6Section, csIniSTATION6CODE, 4);
    FSTATION6OFFSET := Ini.ReadInteger(csIniSTATION6Section, csIniSTATION6OFFSET, 0);
    FSTATION6QUANTITY := Ini.ReadInteger(csIniSTATION6Section, csIniSTATION6QUANTITY, 8);

    {Section: STATION7}
    FSTATION7ADDRESS := Ini.ReadInteger(csIniSTATION7Section, csIniSTATION7ADDRESS, 7);
    FSTATION7CODE := Ini.ReadInteger(csIniSTATION7Section, csIniSTATION7CODE, 4);
    FSTATION7OFFSET := Ini.ReadInteger(csIniSTATION7Section, csIniSTATION7OFFSET, 0);
    FSTATION7QUANTITY := Ini.ReadInteger(csIniSTATION7Section, csIniSTATION7QUANTITY, 8);

    {Section: STATION8}
    FSTATION8ADDRESS := Ini.ReadInteger(csIniSTATION8Section, csIniSTATION8ADDRESS, 8);
    FSTATION8CODE := Ini.ReadInteger(csIniSTATION8Section, csIniSTATION8CODE, 4);
    FSTATION8OFFSET := Ini.ReadInteger(csIniSTATION8Section, csIniSTATION8OFFSET, 0);
    FSTATION8QUANTITY := Ini.ReadInteger(csIniSTATION8Section, csIniSTATION8QUANTITY, 8);

    {Section: STATION9}
    FSTATION9ADDRESS := Ini.ReadInteger(csIniSTATION9Section, csIniSTATION9ADDRESS, 9);
    FSTATION9CODE := Ini.ReadInteger(csIniSTATION9Section, csIniSTATION9CODE, 4);
    FSTATION9OFFSET := Ini.ReadInteger(csIniSTATION9Section, csIniSTATION9OFFSET, 0);
    FSTATION9QUANTITY := Ini.ReadInteger(csIniSTATION9Section, csIniSTATION9QUANTITY, 8);

    {Section: STATION10}
    FSTATION10ADDRESS := Ini.ReadInteger(csIniSTATION10Section, csIniSTATION10ADDRESS, 10);
    FSTATION10CODE := Ini.ReadInteger(csIniSTATION10Section, csIniSTATION10CODE, 4);
    FSTATION10OFFSET := Ini.ReadInteger(csIniSTATION10Section, csIniSTATION10OFFSET, 0);
    FSTATION10QUANTITY := Ini.ReadInteger(csIniSTATION10Section, csIniSTATION10QUANTITY, 8);

    {Section: STATION11}
    FSTATION11ADDRESS := Ini.ReadInteger(csIniSTATION11Section, csIniSTATION11ADDRESS, 11);
    FSTATION11CODE := Ini.ReadInteger(csIniSTATION11Section, csIniSTATION11CODE, 4);
    FSTATION11OFFSET := Ini.ReadInteger(csIniSTATION11Section, csIniSTATION11OFFSET, 0);
    FSTATION11QUANTITY := Ini.ReadInteger(csIniSTATION11Section, csIniSTATION11QUANTITY, 8);

    {Section: STATION12}
    FSTATION12ADDRESS := Ini.ReadInteger(csIniSTATION12Section, csIniSTATION12ADDRESS, 12);
    FSTATION12CODE := Ini.ReadInteger(csIniSTATION12Section, csIniSTATION12CODE, 4);
    FSTATION12OFFSET := Ini.ReadInteger(csIniSTATION12Section, csIniSTATION12OFFSET, 0);
    FSTATION12QUANTITY := Ini.ReadInteger(csIniSTATION12Section, csIniSTATION12QUANTITY, 8);

    {Section: STATION13}
    FSTATION13ADDRESS := Ini.ReadInteger(csIniSTATION13Section, csIniSTATION13ADDRESS, 13);
    FSTATION13CODE := Ini.ReadInteger(csIniSTATION13Section, csIniSTATION13CODE, 4);
    FSTATION13OFFSET := Ini.ReadInteger(csIniSTATION13Section, csIniSTATION13OFFSET, 0);
    FSTATION13QUANTITY := Ini.ReadInteger(csIniSTATION13Section, csIniSTATION13QUANTITY, 8);

    {Section: STATION14}
    FSTATION14ADDRESS := Ini.ReadInteger(csIniSTATION14Section, csIniSTATION14ADDRESS, 14);
    FSTATION14CODE := Ini.ReadInteger(csIniSTATION14Section, csIniSTATION14CODE, 4);
    FSTATION14OFFSET := Ini.ReadInteger(csIniSTATION14Section, csIniSTATION14OFFSET, 0);
    FSTATION14QUANTITY := Ini.ReadInteger(csIniSTATION14Section, csIniSTATION14QUANTITY, 8);

    {Section: STATION15}
    FSTATION15ADDRESS := Ini.ReadInteger(csIniSTATION15Section, csIniSTATION15ADDRESS, 15);
    FSTATION15CODE := Ini.ReadInteger(csIniSTATION15Section, csIniSTATION15CODE, 4);
    FSTATION15OFFSET := Ini.ReadInteger(csIniSTATION15Section, csIniSTATION15OFFSET, 0);
    FSTATION15QUANTITY := Ini.ReadInteger(csIniSTATION15Section, csIniSTATION15QUANTITY, 8);

    {Section: STATION16}
    FSTATION16ADDRESS := Ini.ReadInteger(csIniSTATION16Section, csIniSTATION16ADDRESS, 16);
    FSTATION16CODE := Ini.ReadInteger(csIniSTATION16Section, csIniSTATION16CODE, 4);
    FSTATION16OFFSET := Ini.ReadInteger(csIniSTATION16Section, csIniSTATION16OFFSET, 0);
    FSTATION16QUANTITY := Ini.ReadInteger(csIniSTATION16Section, csIniSTATION16QUANTITY, 8);
  end;
end;

procedure TIniOptions.SaveSettings(Ini: TIniFile);
begin
  if Ini <> nil then
  begin
    {Section: SLAVECOUNT}
    Ini.WriteInteger(csIniSLAVECOUNTSection, csIniSLAVECOUNTCOUNT, FSLAVECOUNTCOUNT);

    {Section: STATION1}
    Ini.WriteInteger(csIniSTATION1Section, csIniSTATION1ADDRESS, FSTATION1ADDRESS);
    Ini.WriteInteger(csIniSTATION1Section, csIniSTATION1CODE, FSTATION1CODE);
    Ini.WriteInteger(csIniSTATION1Section, csIniSTATION1OFFSET, FSTATION1OFFSET);
    Ini.WriteInteger(csIniSTATION1Section, csIniSTATION1QUANTITY, FSTATION1QUANTITY);

    {Section: STATION2}
    Ini.WriteInteger(csIniSTATION2Section, csIniSTATION2ADDRESS, FSTATION2ADDRESS);
    Ini.WriteInteger(csIniSTATION2Section, csIniSTATION2CODE, FSTATION2CODE);
    Ini.WriteInteger(csIniSTATION2Section, csIniSTATION2OFFSET, FSTATION2OFFSET);
    Ini.WriteInteger(csIniSTATION2Section, csIniSTATION2QUANTITY, FSTATION2QUANTITY);

    {Section: STATION3}
    Ini.WriteInteger(csIniSTATION3Section, csIniSTATION3ADDRESS, FSTATION3ADDRESS);
    Ini.WriteInteger(csIniSTATION3Section, csIniSTATION3CODE, FSTATION3CODE);
    Ini.WriteInteger(csIniSTATION3Section, csIniSTATION3OFFSET, FSTATION3OFFSET);
    Ini.WriteInteger(csIniSTATION3Section, csIniSTATION3QUANTITY, FSTATION3QUANTITY);

    {Section: STATION4}
    Ini.WriteInteger(csIniSTATION4Section, csIniSTATION4ADDRESS, FSTATION4ADDRESS);
    Ini.WriteInteger(csIniSTATION4Section, csIniSTATION4CODE, FSTATION4CODE);
    Ini.WriteInteger(csIniSTATION4Section, csIniSTATION4OFFSET, FSTATION4OFFSET);
    Ini.WriteInteger(csIniSTATION4Section, csIniSTATION4QUANTITY, FSTATION4QUANTITY);

    {Section: STATION5}
    Ini.WriteInteger(csIniSTATION5Section, csIniSTATION5ADDRESS, FSTATION5ADDRESS);
    Ini.WriteInteger(csIniSTATION5Section, csIniSTATION5CODE, FSTATION5CODE);
    Ini.WriteInteger(csIniSTATION5Section, csIniSTATION5OFFSET, FSTATION5OFFSET);
    Ini.WriteInteger(csIniSTATION5Section, csIniSTATION5QUANTITY, FSTATION5QUANTITY);

    {Section: STATION6}
    Ini.WriteInteger(csIniSTATION6Section, csIniSTATION6ADDRESS, FSTATION6ADDRESS);
    Ini.WriteInteger(csIniSTATION6Section, csIniSTATION6CODE, FSTATION6CODE);
    Ini.WriteInteger(csIniSTATION6Section, csIniSTATION6OFFSET, FSTATION6OFFSET);
    Ini.WriteInteger(csIniSTATION6Section, csIniSTATION6QUANTITY, FSTATION6QUANTITY);

    {Section: STATION7}
    Ini.WriteInteger(csIniSTATION7Section, csIniSTATION7ADDRESS, FSTATION7ADDRESS);
    Ini.WriteInteger(csIniSTATION7Section, csIniSTATION7CODE, FSTATION7CODE);
    Ini.WriteInteger(csIniSTATION7Section, csIniSTATION7OFFSET, FSTATION7OFFSET);
    Ini.WriteInteger(csIniSTATION7Section, csIniSTATION7QUANTITY, FSTATION7QUANTITY);

    {Section: STATION8}
    Ini.WriteInteger(csIniSTATION8Section, csIniSTATION8ADDRESS, FSTATION8ADDRESS);
    Ini.WriteInteger(csIniSTATION8Section, csIniSTATION8CODE, FSTATION8CODE);
    Ini.WriteInteger(csIniSTATION8Section, csIniSTATION8OFFSET, FSTATION8OFFSET);
    Ini.WriteInteger(csIniSTATION8Section, csIniSTATION8QUANTITY, FSTATION8QUANTITY);

    {Section: STATION9}
    Ini.WriteInteger(csIniSTATION9Section, csIniSTATION9ADDRESS, FSTATION9ADDRESS);
    Ini.WriteInteger(csIniSTATION9Section, csIniSTATION9CODE, FSTATION9CODE);
    Ini.WriteInteger(csIniSTATION9Section, csIniSTATION9OFFSET, FSTATION9OFFSET);
    Ini.WriteInteger(csIniSTATION9Section, csIniSTATION9QUANTITY, FSTATION9QUANTITY);

    {Section: STATION10}
    Ini.WriteInteger(csIniSTATION10Section, csIniSTATION10ADDRESS, FSTATION10ADDRESS);
    Ini.WriteInteger(csIniSTATION10Section, csIniSTATION10CODE, FSTATION10CODE);
    Ini.WriteInteger(csIniSTATION10Section, csIniSTATION10OFFSET, FSTATION10OFFSET);
    Ini.WriteInteger(csIniSTATION10Section, csIniSTATION10QUANTITY, FSTATION10QUANTITY);

    {Section: STATION11}
    Ini.WriteInteger(csIniSTATION11Section, csIniSTATION11ADDRESS, FSTATION11ADDRESS);
    Ini.WriteInteger(csIniSTATION11Section, csIniSTATION11CODE, FSTATION11CODE);
    Ini.WriteInteger(csIniSTATION11Section, csIniSTATION11OFFSET, FSTATION11OFFSET);
    Ini.WriteInteger(csIniSTATION11Section, csIniSTATION11QUANTITY, FSTATION11QUANTITY);

    {Section: STATION12}
    Ini.WriteInteger(csIniSTATION12Section, csIniSTATION12ADDRESS, FSTATION12ADDRESS);
    Ini.WriteInteger(csIniSTATION12Section, csIniSTATION12CODE, FSTATION12CODE);
    Ini.WriteInteger(csIniSTATION12Section, csIniSTATION12OFFSET, FSTATION12OFFSET);
    Ini.WriteInteger(csIniSTATION12Section, csIniSTATION12QUANTITY, FSTATION12QUANTITY);

    {Section: STATION13}
    Ini.WriteInteger(csIniSTATION13Section, csIniSTATION13ADDRESS, FSTATION13ADDRESS);
    Ini.WriteInteger(csIniSTATION13Section, csIniSTATION13CODE, FSTATION13CODE);
    Ini.WriteInteger(csIniSTATION13Section, csIniSTATION13OFFSET, FSTATION13OFFSET);
    Ini.WriteInteger(csIniSTATION13Section, csIniSTATION13QUANTITY, FSTATION13QUANTITY);

    {Section: STATION14}
    Ini.WriteInteger(csIniSTATION14Section, csIniSTATION14ADDRESS, FSTATION14ADDRESS);
    Ini.WriteInteger(csIniSTATION14Section, csIniSTATION14CODE, FSTATION14CODE);
    Ini.WriteInteger(csIniSTATION14Section, csIniSTATION14OFFSET, FSTATION14OFFSET);
    Ini.WriteInteger(csIniSTATION14Section, csIniSTATION14QUANTITY, FSTATION14QUANTITY);

    {Section: STATION15}
    Ini.WriteInteger(csIniSTATION15Section, csIniSTATION15ADDRESS, FSTATION15ADDRESS);
    Ini.WriteInteger(csIniSTATION15Section, csIniSTATION15CODE, FSTATION15CODE);
    Ini.WriteInteger(csIniSTATION15Section, csIniSTATION15OFFSET, FSTATION15OFFSET);
    Ini.WriteInteger(csIniSTATION15Section, csIniSTATION15QUANTITY, FSTATION15QUANTITY);

    {Section: STATION16}
    Ini.WriteInteger(csIniSTATION16Section, csIniSTATION16ADDRESS, FSTATION16ADDRESS);
    Ini.WriteInteger(csIniSTATION16Section, csIniSTATION16CODE, FSTATION16CODE);
    Ini.WriteInteger(csIniSTATION16Section, csIniSTATION16OFFSET, FSTATION16OFFSET);
    Ini.WriteInteger(csIniSTATION16Section, csIniSTATION16QUANTITY, FSTATION16QUANTITY);
  end;
end;

initialization
  IniOptions := TIniOptions.Create;

finalization
  IniOptions.Free;

end.

⌨️ 快捷键说明

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