05-05-2022 10:23 PM
I`m using NI USB-6361 and trying to read out the counter values from two counters. Because a task can contain only one counter input channel, I created 2 tasks with 1 input channels each. Then I want to read out the count values of them simultaneously, so I want to use only one Counter 2D U32 NChan NSamp read module. But how should I connect the two tasks to the read module?
Thanks very much!
05-06-2022 12:43 PM
Hi Fieldx,
@Fieldx wrote:
Because a task can contain only one counter input channel, I created 2 tasks with 1 input channels each.
But how should I connect the two tasks to the read module?
Simple answer: when there are two tasks then you need two DAQmxRead functions to read their values…
05-06-2022 02:35 PM
You should likely be configuring the tasks to use a sample clock (and buffer) with a call to DAQmx Timing. Then both tasks would latch and buffer their count values simultaneously.
Counter tasks usually can't derive their own sample clock so you'll need to provide one. It could come from a 3rd counter task set up as a continuous pulse train. Or it could come from something like an AI task.
If both tasks are configured to use the same signal as their sample clock, and if both tasks are started before that sample clock signal begins, you can read multi-sample blocks of data at a time from each task and know that the sampling times for that data are sync'ed.
-Kevin P
(Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).