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

📄 main.pas

📁 六路三十二次谐波信号发生器 可产生三十次以下任何谐波叠加的波形
💻 PAS
📖 第 1 页 / 共 3 页
字号:
  b:integer;
  cc:boolean;
  begin
       //添加选中波形
  for i := 0 to listbox1.Count -1 do
    begin
    if listbox1.Selected[i] then
      begin
      for b:=0 to listbox6.Count-1 do
        begin
        //判断是否已经添加过
        if listbox6.Items[b]=listbox1.Items[i] then
          begin
          cc:=true
          end;
        end;

     if cc=true then
      begin
      cc:=false;
      end
     else
      begin
      listbox6.Items.Add(listbox1.Items[i]);
      m3:=m3+1;
     // Label1.Caption:=inttostr(m);
      end;

    end;
  end;
 end;

//################################
//四通道添加波形
procedure TForm1.Button19Click(Sender: TObject);
var
  i : integer;
  b:integer;
  cc:boolean;
  begin
       //添加选中波形
  for i := 0 to listbox1.Count -1 do
    begin
    if listbox1.Selected[i] then
      begin
      for b:=0 to listbox7.Count-1 do
        begin
        //判断是否已经添加过
        if listbox7.Items[b]=listbox1.Items[i] then
          begin
          cc:=true
          end;
        end;

     if cc=true then
      begin
      cc:=false;
      end
     else
      begin
      listbox7.Items.Add(listbox1.Items[i]);
      m4:=m4+1;
     // Label1.Caption:=inttostr(m);
      end;

    end;
  end;
 end;

//################################
//五通道添加波形
procedure TForm1.Button22Click(Sender: TObject);
var
  i : integer;
  b:integer;
  cc:boolean;
  begin
       //添加选中波形
  for i := 0 to listbox1.Count -1 do
    begin
    if listbox1.Selected[i] then
      begin
      for b:=0 to listbox8.Count-1 do
        begin
        //判断是否已经添加过
        if listbox8.Items[b]=listbox1.Items[i] then
          begin
          cc:=true
          end;
        end;

     if cc=true then
      begin
      cc:=false;
      end
     else
      begin
      listbox8.Items.Add(listbox1.Items[i]);
      m5:=m5+1;
     // Label1.Caption:=inttostr(m);
      end;

    end;
  end;
 end;

//################################
//六通道添加波形
procedure TForm1.Button24Click(Sender: TObject);
var
  i : integer;
  b:integer;
  cc:boolean;
  begin
       //添加选中波形
  for i := 0 to listbox1.Count -1 do
    begin
    if listbox1.Selected[i] then
      begin
      for b:=0 to listbox9.Count-1 do
        begin
        //判断是否已经添加过
        if listbox9.Items[b]=listbox1.Items[i] then
          begin
          cc:=true
          end;
        end;

     if cc=true then
      begin
      cc:=false;
      end
     else
      begin
      listbox9.Items.Add(listbox1.Items[i]);
      m6:=m6+1;
     // Label1.Caption:=inttostr(m);
      end;

    end;
  end;
 end;

//################################
//一通道删除波形
procedure TForm1.Button26Click(Sender: TObject);
var
  i : integer;
  begin

  //防止在无删除项目时M减一
  for i := 0 to listbox4.Count -1 do
    begin
    if listbox4.Selected[i] then
     begin
  //   m:=m-1;
     end;
     end;
   // Label1.Caption:=inttostr(m);
    //删除选中的项目
    listbox4.Items.Delete(listbox4.ItemIndex);
 end;

//################################
//二通道删除波形
procedure TForm1.Button13Click(Sender: TObject);
var
  i : integer;
  begin

  //防止在无删除项目时M减一
  for i := 0 to listbox5.Count -1 do
    begin
    if listbox5.Selected[i] then
     begin
  //   m:=m-1;
     end;
     end;
   // Label1.Caption:=inttostr(m);
    //删除选中的项目
    listbox5.Items.Delete(listbox5.ItemIndex);
 end;

//################################
//三通道删除波形
procedure TForm1.Button17Click(Sender: TObject);
var
  i : integer;
  begin

  //防止在无删除项目时M减一
  for i := 0 to listbox6.Count -1 do
    begin
    if listbox6.Selected[i] then
     begin
  //   m:=m-1;
     end;
     end;
   // Label1.Caption:=inttostr(m);
    //删除选中的项目
    listbox6.Items.Delete(listbox6.ItemIndex);
 end;

//################################
//四通道删除波形
procedure TForm1.Button21Click(Sender: TObject);
var
  i : integer;
  begin

  //防止在无删除项目时M减一
  for i := 0 to listbox7.Count -1 do
    begin
    if listbox7.Selected[i] then
     begin
  //   m:=m-1;
     end;
     end;
   // Label1.Caption:=inttostr(m);
    //删除选中的项目
    listbox7.Items.Delete(listbox7.ItemIndex);
 end;

//################################
//五通道删除波形
procedure TForm1.Button23Click(Sender: TObject);
var
  i : integer;
  begin

  //防止在无删除项目时M减一
  for i := 0 to listbox8.Count -1 do
    begin
    if listbox8.Selected[i] then
     begin
  //   m:=m-1;
     end;
     end;
   // Label1.Caption:=inttostr(m);
    //删除选中的项目
    listbox8.Items.Delete(listbox8.ItemIndex);
 end;

//################################
//六通道删除波形
procedure TForm1.Button25Click(Sender: TObject);
var
  i : integer;
  begin

  //防止在无删除项目时M减一
  for i := 0 to listbox9.Count -1 do
    begin
    if listbox9.Selected[i] then
     begin
  //   m:=m-1;
     end;
     end;
   // Label1.Caption:=inttostr(m);
    //删除选中的项目
    listbox9.Items.Delete(listbox9.ItemIndex);
 end;

//################################
//一通道显示选中波形
procedure TForm1.ListBox4Click(Sender: TObject);
var
  i:integer;
  str:string;
  begin

      //显示当前选中波次
       for i := 0 to listbox4.Count -1 do
          begin
          if listbox4.Selected[i] then
             begin

              str:=trim(ListBox4.Items[i]);
              str:=ansireplacestr(str,'次谐波','');
              Label23.Caption:=str;
              //abort;
              edit1.Text:=inttostr(l1[i]);
              edit2.Text:=inttostr(p1[i]);
             end;
          end;
  end;

//################################
//二通道显示选中波形
procedure TForm1.ListBox5Click(Sender: TObject);
var
  i:integer;
  str:string;
  begin
        //显示当前选中波次
       for i := 0 to listbox5.Count -1 do
          begin
          if listbox5.Selected[i] then
             begin
              str:=trim(ListBox5.Items[i]);
              str:=ansireplacestr(str,'次谐波','');
              Label24.Caption:=str;
            //  abort;
              edit3.Text:=inttostr(l2[i]);
              edit4.Text:=inttostr(p2[i]);
             end;
          end;
  end;

//################################
//三通道显示选中波形
procedure TForm1.ListBox6Click(Sender: TObject);
var
  i:integer;
  str:string;
  begin
        //显示当前选中波次
       for i := 0 to listbox6.Count -1 do
          begin
          if listbox6.Selected[i] then
             begin
              str:=trim(ListBox6.Items[i]);
              str:=ansireplacestr(str,'次谐波','');
              Label25.Caption:=str;
              //abort;
              edit5.Text:=inttostr(l3[i]);
              edit6.Text:=inttostr(p3[i]);
             end;
          end;
  end;

//################################
//四通道显示选中波形
procedure TForm1.ListBox7Click(Sender: TObject);
var
  i:integer;
  str:string;
  begin

      //显示当前选中波次
       for i := 0 to listbox7.Count -1 do
          begin
          if listbox7.Selected[i] then
             begin
              str:=trim(ListBox7.Items[i]);
              str:=ansireplacestr(str,'次谐波','');
              Label26.Caption:=str;
             // abort;
              edit7.Text:=inttostr(l4[i]);
              edit8.Text:=inttostr(p4[i]);
             end;
          end;
  end;

//################################
//五通道显示选中波形
procedure TForm1.ListBox8Click(Sender: TObject);
var
  i:integer;
  str:string;
  begin

      //显示当前选中波次
       for i := 0 to listbox8.Count -1 do
          begin
          if listbox8.Selected[i] then
             begin
              str:=trim(ListBox8.Items[i]);
              str:=ansireplacestr(str,'次谐波','');
              Label28.Caption:=str;
              //abort;
              edit9.Text:=inttostr(l5[i]);
              edit10.Text:=inttostr(p5[i]);
             end;
          end;
  end;

//################################
//六通道显示选中波形
procedure TForm1.ListBox9Click(Sender: TObject);
var
  i:integer;
  str:string;
  begin
        //显示当前选中波次
       for i := 0 to listbox9.Count -1 do
          begin
          if listbox9.Selected[i] then
             begin
              str:=trim(ListBox9.Items[i]);
              str:=ansireplacestr(str,'次谐波','');
              Label29.Caption:=str;
              //abort;
              edit11.Text:=inttostr(l6[i]);
              edit12.Text:=inttostr(p6[i]);

             end;
          end;
  end;

//################################
//一通道波形更改设置
procedure TForm1.Button9Click(Sender: TObject);
var
  i:integer;
  begin
  for i := 0 to listbox4.Count -1 do
    begin                          //更改提交的数据
    if listbox4.Selected[i] then
      begin
      l1[i]:=strtoint(edit1.Text);
      p1[i]:=strtoint(edit2.Text);
      end;
    end;
  end;

  //################################
//二通道波形更改设置
procedure TForm1.Button20Click(Sender: TObject);
var
  i:integer;
  begin
  for i := 0 to listbox5.Count -1 do
    begin                          //更改提交的数据
    if listbox5.Selected[i] then
      begin
      l2[i]:=strtoint(edit3.Text);
      p2[i]:=strtoint(edit4.Text);
      end;
    end;
  end;

//################################
//三通道波形更改设置
procedure TForm1.Button16Click(Sender: TObject);
var
  i:integer;
  begin
  for i := 0 to listbox6.Count -1 do
    begin                          //更改提交的数据
    if listbox6.Selected[i] then
      begin
      l3[i]:=strtoint(edit5.Text);
      p3[i]:=strtoint(edit6.Text);
      end;
    end;
  end;

  //################################
//四通道波形更改设置
procedure TForm1.Button12Click(Sender: TObject);
var
  i:integer;
  begin
  for i := 0 to listbox7.Count -1 do
    begin                          //更改提交的数据
    if listbox7.Selected[i] then
      begin
      l4[i]:=strtoint(edit7.Text);
      p4[i]:=strtoint(edit8.Text);
      end;
    end;
  end;

  //################################
//五通道波形更改设置
procedure TForm1.Button14Click(Sender: TObject);
var
  i:integer;
  begin
  for i := 0 to listbox8.Count -1 do
    begin                          //更改提交的数据
    if listbox8.Selected[i] then
      begin
      l5[i]:=strtoint(edit9.Text);
      p5[i]:=strtoint(edit10.Text);
      end;
    end;
  end;

//################################
//六通道波形更改设置
procedure TForm1.Button18Click(Sender: TObject);
var
  i:integer;
  begin
  for i := 0 to listbox9.Count -1 do
    begin                          //更改提交的数据
    if listbox9.Selected[i] then
      begin
      l6[i]:=strtoint(edit11.Text);
      p6[i]:=strtoint(edit12.Text);
      end;
    end;
  end;

procedure TForm1.N7Click(Sender: TObject);
begin
close;
end;

procedure TForm1.N8Click(Sender: TObject);
begin
showmessage('谢谢使用!'+#13+#13+#9+'厦门泰瑞达科技'+#13+#9+'    '+'2008.08');
end;

procedure TForm1.N3Click(Sender: TObject);
begin
showmessage('按钮“完成波形添加”进行波形参数初始化'+#13+'*波形参数初始化后才可进行波形设置'
+#13+'*增减波形后需初始化波形参数'+#13+'按钮“重置”将清空所有数据');
end;

end.

⌨️ 快捷键说明

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