02-01-2007 11:41 AM
I am using a simulated NI-6251 device and DAQmx driver version 8.3. I am controlling the device through a C# program (through .NET support from the driver).
My objective is to synchronize start of reading from analog and start of reading from digital input channels. The code that I tried is given below:
1: Task task1 = new Task();
2: task1.AIChannels.CreateVoltageChannel("Dev3/ai0", "", AITerminalConfiguration.Differential, -10, 10, AIVoltageUnits.Volts);
3: task1.Timing.ConfigureSampleClock(string.Empty, N1, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, N1);
4: reader1 = new AnalogSingleChannelReader(task1.Stream);
5: Task task2 = new Task();
6: task2.DIChannels.CreateChannel("Dev3/port0", "", ChannelLineGrouping.OneChannelForAllLines);
7: task2.Timing.ConfigureSampleClock("ai/SampleClock", N2, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, N2);
8: task2.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("ai/StartTrigger", DigitalEdgeStartTriggerEdge.Rising);
9: reader2 = new DigitalSingleChannelReader(task2.Stream);
The code does not work, since line 8 causes an DAQ exception: “Specified property is not supported by the device or is not applicable to the task.” DAQmx help file shows that simulated devices support (non-hardware) timing. One thread on this forum mentions that triggering should be used for synchronization (URL: http://forums.ni.com/ni/board/message?board.id=170&message.id=214314&requireLogin=False). Another thread suggests simply starting reading of digital channels before starting reading of analog ones (URL: http://forums.ni.com/ni/board/message?board.id=250&message.id=8437&requireLogin=False). Since none of these two methods seems to work for me, does anyone have any suggestions how to synchronize (start of) reading of analog and digital channels in C#? Also, is there a way to check whether the readings started simultaneously?
Any suggestions will be much appreciated. Thanks!
02-02-2007 05:53 PM