LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read signals from TWO counter tasks using only ONE DAQmx Read (VI) Counter 2D U32 NChan NSamp?

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? 

 
 

QQ截图20220506112224.png

Thanks very much!

0 Kudos
Message 1 of 3
(127 Views)

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…

Best regards,
GerdW


using LV2016/2019/2020 on Win8.1/10+cRIO
0 Kudos
Message 2 of 3
(81 Views)

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

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 3 of 3
(70 Views)