I have perfectly working vi (you can find it in attachments) where I am using two DAQmx Read (Counter 1D U32 1chan Nsamp).vi to read counter input edges of two terminals (PFI9, PFI10). Now I am trying to figure out how to use a single DAQmx Read (Counter 2D U32 Nchan Nsamp).vi to read counter input edges of same terminals (PFI9, PFI10). The main objective of doing so is to ensure the synchronization of the two arrays read.
My DAQ device is USB-6351, if anyone is familiar with how to get started with this situation, ANY help would be greatly appreciated.
Please let me know if you need any sort of additional information from me to understand what I am doing.
Solved! Go to Solution.
As far back as I can remember, any NI DAQ devices I've used do not support multi-channel counter input tasks. (Caveat: I've never used a dedicated cDAQ counter/timer module). That includes X-series devices like yours.
But although the software calls to the Read function can't be perfectly synchronized, your measurements *can* be. In fact, a quick look at your code suggests that they already *are*.
- both counter input tasks use the same signal as their sample clock
- that signal is the output of another counter that you control and it isn't started until after the input tasks are started
The device samples the two counts simultaneously and the driver delivers those samples to the tasks' buffers. You're also correctly reading the same # samples from both tasks, so the corresponding counts can be known to have been sampled at the same time.
So you actually already solved your own problem, I'm just giving you the assurance that the two tasks' data are in fact sync'ed already.
Thank you so much Kevin, for confirming the synchronization of the two arrays. I am still curious about the use cases of the DAQmx Read (Counter 2D U32 Nchan Nsamp).vi. I assumed using it instead of two read counter vi can reduce the complexity of my code.
Well, it was a reasonable assumption and worth a try. Maybe multi-counter input measurements are supported on some NI DAQ device I'm not familiar with? I know there's a dedicated counter/timer module for cDAQ that supports some unique things, but am not sure what they are.