12-02-2017 10:53 AM
I am trying to write a DAQmx program (C#) that reads in a set number of points from various analog and digital channels from a PXI multifunction DAQ card. I want to start the acquisitions on the same trigger and collect an equal number of points at the some sample rate. I think I can setup an AnalogMultiChannelReader and a DigitalMultiChannelReader with appropriate clocks and then call ReadMultiSample on each to do this. The problem is that the trigger is external and it is possible it can arrive between starting each of the reads such that whichever process is called first is triggered but the other is not (presumably the time window here is very short but the triggers are very frequent and the program will run thousands of times so it seems it would be a possible bug). Is there a way to start both tasks simultaneously? Or a cleaner way to approach problem?
Solved! Go to Solution.
12-04-2017 10:41 AM
Here's an approach:
As long as you want the same sample rate for both tasks, you can sync them by sharing a sample clock. Designate your AI task as the master (b/c you didn't identify your hardware, some boards wouldn't support DI as a master), run the DI task off the "AISampleClock" signal, and be sure to start the DI task before starting the AI task.
You can further set the AI task to be externally triggered if you also need to be sync'ed to that external repeating signal.
I'm a LabVIEW guy so I can't really help with any of the C# syntax. The trickiest part will be the exact way to specify that the DI task should use the special signal "AISampleClock". It should be findable, I just don't know where to point.
-Kevin P