/// <summary> /// AO写入数据AI读取数据 /// </summary> private void AOWriteAIRead() { //配置AI与AO AIConfig(); AOConfig(); //添加延时 aotask.SamplesToUpdate = writeValue.Length; aitask.SamplesToAcquire = writeValue.Length + (int)numericUpDownDelaySamples.Value; readValue = new double[aitask.SamplesToAcquire, aitask.Channels.Count]; //AO写入数据 AI读取数据 aotask.WriteData(writeValue, -1); aotask.Start(); aitask.Start(); aitask.SendSoftTrigger(); aitask.ReadData(ref readValue, -1); TempInput = new double[writeValue.Length]; TempOutput = new double[writeValue.Length]; for (int k = 0; k < writeValue.Length; k++) { TempInput[k] = readValue[k, 0]; //TempInput[k] = writeValue[k]; TempOutput[k] = readValue[k + (int)numericUpDownDelaySamples.Value, 1]; } aotask.WaitUntilDone(-1); aotask.Stop(); aotask.Channels.Clear(); aitask.Stop(); aitask.Channels.Clear(); //WriteData(); }
public void ReadData(ref double[] buf, int timeOut) { AITask.ReadData(ref buf, timeOut); }