Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Simultaneous triggered read of analog and digital inputs

Solved!
Go to solution

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?

0 Kudos
Message 1 of 2
(1,375 Views)
Solution
Accepted by lacaldwell

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

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW?
0 Kudos
Message 2 of 2
(1,307 Views)