Delphi7如何实现PCI1713板卡的数据采集,要求多通道显示(即读取7个通道的数据),效果如下图所示,我是新手,所以不知道怎么办了,望各位多帮帮忙,谢谢!!!

解决方案 »

  1.   

    //采集数据
    procedure TForm1.getdata(DrvIndex:integer);
    begin
      AIconfig.DasChan := DrvIndex;
      AIconfig.DasGain := 0;
      errcde := DRV_AIConfig(DriverHandle, AIconfig);
      If (ErrCde <> 0) Then begin
        DRV_GetErrorMessage(errcde, pszErrMsg);
        Response := Application.MessageBox(pszErrMsg, '设备错误!!',MB_OK);
        close;
      End;
      AIvoltageIn[DrvIndex].chan := AIconfig.DasChan;
      AIvoltageIn[DrvIndex].gain := AIconfig.DasGain;
      AIvoltageIn[DrvIndex].TrigMode := 0 ;
      AIvoltageIn[DrvIndex].voltage := @voltage[DrvIndex];
      num:=1;
      errcde:=DRV_AIVoltageIn(DriverHandle,AIvoltagein[DrvIndex]); //获取通道数据
      if errcde<>0 then
      begin
        DRV_GetErrorMessage(errcde, pszErrMsg);
        Response := Application.MessageBox(pszErrMsg, '通道错误!!',MB_OK);
        exit;
      End;
      data[num]:=voltage[DrvIndex];
      Edt[DrvIndex].Text:=format('%4.3f',[data[num]]);
    end;