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

📄 filedefine.~pas

📁 Delphi编写的ModBus协议上位机软件
💻 ~PAS
📖 第 1 页 / 共 4 页
字号:
    begin
      temp := '[序号]';
      if pos(temp, temstr)=0 then
      begin
        i := i + 1;
        temstr :=Lines.Strings[i];
        k := pos('---', temstr);
        continue;
        end;

      temp1 := getdata(temp, i, tempmemo);
      if strtointdef(temp1,300)>econfile.inputstatetotal then
      begin
        fileerr(inttostr(i)+'行  '+ temp + '值超出[输入开关量数]');
        exit;
        end;
      l := strtointdef(temp1,0);

      temp := '[名称]';
      if pos(temp, temstr)=0 then
      begin
        i := i + 1;
        temstr := Lines.Strings[i];
        k := pos('---', temstr);
        continue;
        end;

      temp1 := getdata(temp, i, tempmemo);
      econfile.inputstatearray[l].name := temp1;

      j := j + 1;
      if j=econfile.inputstatetotal then
      begin
//        fileerr(inttostr(j)+'超过[输入开关量数]的值');
        exit;
      end;

      i := i + 1;
      temstr := Lines.Strings[i];
      k := pos('---', temstr);
    end;
  end;
end;

procedure getholdregisterdata(tempmemo: Tmemo; econfile: Teconfile);
var
  i, j, k, l:integer;
  temstr: string;
  temp, temp1: string;
begin
  with tempmemo do
  begin
    j := 0;
    k := 0;
    for i:=0 to lines.Count do
    begin
        temp := '[保持寄存器名称]';
        temstr := Lines.Strings[i];
        k := pos(temp, temstr);
        if k>0 then
        begin
          j := i;
          break;
          end;
    end;

    if ((i<>j)or(k=0)) then
    begin
      fileerr(NOTFIND+temp);
      exit;
      end;

    i := i + 1;
    temstr := Lines.Strings[i];
    k := pos('---', temstr);
    j := 0;

    while k=0 do
    begin
      temp := '[地址H]';
      if pos(temp,temstr)=0 then
      begin
        i := i + 1;
        temstr := Lines.Strings[i];
        k := pos('---', temstr);
        continue;
        end;

      temp1 := getdata(temp, i, tempmemo);
      if strtointdef(temp1,300)>econfile.holdregistertotal then
      begin
        fileerr(inttostr(i)+'行  '+ temp + '值超出[保持寄存器数]');
        exit;
        end;
      l := strtointdef(temp1, 0);

      temp:='[名称]';
     
      if pos(temp, temstr)=0 then
      begin
        i := i + 1;
        temstr:=Lines.Strings[i];
        k := pos('---', temstr);
        continue;
        end;
      temp1 := getdata(temp, i, tempmemo);
      econfile.holdregisterarray[l].name := temp1;

      j := j + 1;
      if j=econfile.holdregistertotal then
      begin
//        fileerr(inttostr(j)+'超过[保持寄存器数]的值');
        exit;
      end;

      i := i + 1;
      temstr := Lines.Strings[i];
      k := pos('---', temstr);

    end;
  end;
end;

procedure getinputregisterdata(tempmemo: Tmemo; econfile: Teconfile);
var
  i, j, k, l: integer;
  temstr: string;
  temp, temp1: string;
begin
  with tempmemo do
  begin
    j := 0;
    k := 0;
    for i:=0 to lines.Count do
    begin
        temp := '[输入寄存器名称]';
        temstr := Lines.Strings[i];
        k := pos(temp, temstr);
        if k>0 then
        begin
          j := i;
          break;
          end;
    end;

    if ((i<>j)or(k=0)) then
    begin
      fileerr(NOTFIND + temp);
      exit;
      end;

    i := i + 1;
    temstr := Lines.Strings[i];
    k := pos('---', temstr);
    j := 0;

    while k=0 do
    begin
      temp := '[地址I]';
      if pos(temp, temstr)=0 then
      begin
        i := i + 1;
        temstr := Lines.Strings[i];
        k := pos('---', temstr);
        continue;
        end;

      temp1 := getdata(temp, i, tempmemo);
      if strtointdef(temp1,300)>econfile.inputregistertotal then
      begin
        showmessage(tempmemo.Lines[i]);
        fileerr(inttostr(i)+'行  '+ temp + '值大于[输入寄存器数]');
        exit;
        end;
      l := strtointdef(temp1, 0);

      temp := '[名称]';
      if pos(temp, temstr)=0 then
      begin
        i :=i + 1;
        temstr:=Lines.Strings[i];
        k := pos('---', temstr);
        continue;
        end;

      temp1 := getdata(temp, i, tempmemo);
      econfile.inputregisterarray[l].name := temp1;

      j := j + 1;
      if j>=econfile.inputregistertotal then
      begin
//        fileerr(inttostr(j)+'超过[输入寄存器数]的值');
        exit;
      end;

      i := i + 1;
      temstr := Lines.Strings[i];
      k := pos('---', temstr);
    end;
  end;
end;

procedure getsetpardata(tempmemo: Tmemo; econfile: Teconfile);
var
  i, j, k: integer;
  temstr: string;
  temp, temp1: string;
begin
  with tempmemo do
  begin
    j := 0;
    k := 0;
    for i:=0 to lines.Count do
    begin
        temp := '[输入寄存器与保持寄存器关联名称]';
        temstr := Lines.Strings[i];
        k := pos(temp, temstr);
        if k>0 then
        begin
          j := i;
          break;
          end;
    end;

    if ((i<>j)or(k=0)) then
    begin
      fileerr(NOTFIND + temp);
      exit;
      end;

    i := i + 1;
    temstr := Lines.Strings[i];
    k := pos('---', temstr);
    j := 0;

    while k=0 do
    begin
      temp := '[地址I]';
      if pos(temp, temstr)=0 then
      begin
        i := i + 1;
        temstr := Lines.Strings[i];
        k := pos('---', temstr);
        continue;
        end;

      temp1 := getdata(temp, i, tempmemo);
      if strtointdef(temp1,300)>econfile.inputregistertotal then
      begin
        fileerr(inttostr(i)+'行  '+ temp + '值大于[输入寄存器数]');
        exit;
        end;
      
      econfile.setpararray[j + 1].address1 := temp1;

      temp := '[地址H]';
      
      if pos(temp, temstr)=0 then
      begin
        i := i + 1;
        temstr :=Lines.Strings[i];
        k := pos('---', temstr);
        continue;
        end;

      temp1 := getdata(temp, i, tempmemo);
      if strtointdef(temp1, 300)>econfile.holdregistertotal then
      begin
        fileerr(temp + '值大于[保持寄存器数]');
        exit;
        end;
      
      econfile.setpararray[j + 1].address2 := temp1;

      temp := '[名称]';
      
      if pos(temp, temstr)=0 then
      begin
        i := i + 1;
        temstr := Lines.Strings[i];
        k := pos('---', temstr);
        continue;
        end;
      temp1 := getdata(temp, i, tempmemo);
      econfile.setpararray[j + 1].name := temp1;

      j := j + 1;
      if j=econfile.setpartotal then
      begin
//        fileerr(inttostr(j)+'超过[输入寄存器与保持寄存器关联数]的值');
        exit;
      end;

      i := i + 1;
      temstr := Lines.Strings[i];
      k := pos('---', temstr);
    end;

  end;
end;

procedure getsetprotectdata(tempmemo: Tmemo; econfile: Teconfile);
var
  i, j, k: integer;
  temstr: string;
  temp, temp1: string;
begin
  with tempmemo do
  begin
    j := 0;
    k := 0;
    for i:=0 to lines.Count do
    begin
        temp := '[保护名称]';
        temstr := Lines.Strings[i];
        k := pos(temp, temstr);
        if k>0 then
        begin
          j := i;
          break;
          end;
    end;

    if ((i<>j)or(k=0)) then
    begin
      fileerr(NOTFIND + temp);
      exit;
      end;

    i := i + 1;
    temstr := Lines.Strings[i];
    k := pos('---', temstr);
    j := 0;

    while k=0 do
    begin
      temp := '[地址H1]';
      
      if pos(temp, temstr)=0 then
      begin
        i := i + 1;
        temstr := Lines.Strings[i];
        k := pos('---', temstr);
        continue;
        end;

      temp1 := getdata(temp, i, tempmemo);
      if strtointdef(temp1,300)>econfile.holdregistertotal then
      begin
        fileerr(inttostr(i)+'行  '+ temp + '值大于[保持寄存器数]');
        exit;
        end;
      
      econfile.setprotectarray[j + 1].address1 := temp1;

      temp := '[地址H2]';
      
      if pos(temp, temstr)=0 then
      begin
        i := i + 1;
        temstr:=Lines.Strings[i];
        k := pos('---', temstr);
        continue;
        end;

      temp1 := getdata(temp, i, tempmemo);
      if strtointdef(temp1,300)>econfile.holdregistertotal then
      begin
        i :=i + 1;
        temstr:=Lines.Strings[i];
        k := pos('---', temstr);
        continue;
        end;

      econfile.setprotectarray[j+1].address2 := temp1;


      temp := '[地址H3]';
      
      if pos(temp, temstr)=0 then
      begin
        i := i + 1;
        temstr := Lines.Strings[i];
        k := pos('---', temstr);
        continue;
        end;

      temp1 := getdata(temp, i, tempmemo);
      if strtointdef(temp1,300)>econfile.holdregistertotal then
      begin
        fileerr(temp + '值大于[保持寄存器数]');
        exit;
        end;
      
      econfile.setprotectarray[j + 1].address3 := temp1;

      temp := '[名称]';
      
      if pos(temp, temstr)=0 then
      begin
        i := i + 1;
        temstr := Lines.Strings[i];
        k := pos('---', temstr);
        continue;
        end;
      temp1 := getdata(temp, i, tempmemo);
      econfile.setprotectarray[j + 1].name := temp1;

      j := j + 1;
      if j=econfile.setprotecttotal then
      begin
//        fileerr(inttostr(j)+'超过[保护类型数]的值');
        exit;
      end;

      i := i + 1;
      temstr := Lines.Strings[i];
      k := pos('---', temstr);
    end;

  end;
end;

procedure getxiangliangdata(tempmemo: Tmemo; econfile: Teconfile);
var
  i, j, k: integer;
  temstr: string;
  temp, temp1: string;
begin
  with tempmemo do
  begin
    j := 0;
    k := 0;
    for i:=0 to lines.Count do
    begin
        temp := '[相量图定义]';
        temstr := Lines.Strings[i];
        k := pos(temp, temstr);
        if k>0 then
        begin
          j := i;
          break;
          end;
    end;

    if ((i<>j)or(k=0)) then
    begin
      econfile.setxiangliangtotal := 0;
//      fileerr(NOTFIND+temp);
      exit;
      end;

    i := i + 1;
    temstr := Lines.Strings[i];
    k := pos('---', temstr);
    j := 0;

    while k=0 do
    begin
      temp := '[地址I]';
      if pos(temp, temstr)=0 then
      begin
        i := i + 1;
        temstr := Lines.Strings[i];
        k := pos('---', temstr);
        continue;
        end;

      temp1 := getdata(temp, i, tempmemo);
      if strtointdef(temp1,300)>econfile.inputregistertotal then
      begin
        fileerr(inttostr(i)+'行  '+ temp + '值超出[输入寄存器数]');
        exit;
        end;
      econfile.xiangliangarray[j + 1].address1 := temp1;

      temp := '[名称]';

      if pos(temp, temstr)=0 then
      begin
        i := i + 1;
        temstr := Lines.Strings[i];
        k := pos('---', temstr);
        continue;
        end;
      temp1 := getdata(temp, i, tempmemo);
      econfile.xiangliangarray[j + 1].name := temp1;

      i := i + 1;
      j := j + 1;
      temstr := Lines.Strings[i];
      k := pos('---', temstr);

    end;


    for i:=0 to lines.Count do
    begin
        temp := '[相量图系数定义]';
        temstr := Lines.Strings[i];
        k := pos(temp, temstr);
        if k>0 then
        begin
          j := i;
          break;
          end;
    end;

    if ((i<>j)or(k=0)) then
    begin
      fileerr(NOTFIND + temp);
      exit;
      end;

    i := i + 1;
    temstr := Lines.Strings[i];
    k := pos('---', temstr);
    j := 0;

    while k=0 do
    begin
      temp := '[系数值]';

⌨️ 快捷键说明

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