From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Counter Tasks

Spoiler

Hello everyone.

I am programming in LabWindows, using NIDAQmx to connect to a PCI-6351 card.
 

I'm trying to get multiple tasks to operate at the same time.  We actually have 2 PWM (measure duty cycle) signals and possibly an encoder signal.  The person buying the card was hoping a PCI-6351 would work as it has 4 counter channels.  Although the card doesn't have built in option to measure duty cycle, I figured I could use two continuous tasks to read the on and off pulse times.

 

I can't get two tasks to operate at the same time.  Through my trials I get an error no matter what I try:

- can't reference the same input line in two channels

- can't have two counter channels in the same task

- can't have two counter tasks active, using the same timer resource, and can't seem to select different timer sources?

 

There must be something (hopefully simple) that I am missing.  What good is a 4 counter card if I can only use 1 at a time.

 

Grateful for any feedback!
Mande.

0 Kudos
Message 1 of 2
(2,428 Views)

- can't reference the same input line in two channels

- can't have two counter channels in the same task

- can't have two counter tasks active, using the same timer resource, and can't seem to select different timer sources?


Yeah, I think there may be some fairly simple things you're missing.  As to your 3 highlighted comments:

- I've frequently referenced the same PFI line for use by multiple counter tasks

- Agreed, each distinct counter measurement will need to be a unique task

- Unsure of exactly what you mean about "timer sources."  I've frequently referenced the same clock signal for use by multiple tasks.

 

As a LabVIEW guy, I can't help with LabWindows syntax but am confident you'll have the same capabilities available from DAQmx *somehow*.   For example, the LabVIEW API presents Pulse measurement modes that can be used with X-series boards like yours, including one for Freq & Duty cycle.   If you can post your code, hopefully someone that knows the text API syntax can help more.

 

If you're looking to sync the start times of multiple counter input tasks, be aware that you'll need to use an "Arm Start" trigger.  If you do, be further aware that NI made what I consider a misguided choice for X-series boards, making it impossible to determine the time from the Arm Start trigger signal to the first pulse measurement.  Here's some official info, here's one of my complaints.

 

 

-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? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 2 of 2
(2,412 Views)