LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Counter Tasks

Solved!
Go to solution

Hello everyone.

This isn't specific to Lab/Windows, but I don't see a thread specifically for NIDAQmx.

 

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 timebase resource?

 

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

 

Grateful for any feedback!
Mande.

0 Kudos
Message 1 of 6
(2,733 Views)
Solution
Accepted by topic author Mande

One possible solution could be to physically drive the same signal to two counters and start two independent tasks, one for period measurement and the other for pulse width, calculating the duty cycle based on those two measurements. I never tried such a configuration but I suppose it should work.

In similar situations I have used an analog channel to acquire the pwm signal and PulseMeas function to obtain both frequency and duty cycle.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 6
(2,716 Views)

I forgot to say that such a question could be posted as well to Multifunction DAQ board. In that case, though, you should clarify explicitly that you are using CVI or you are very likely to get LabVIEW-related answers. Which are not bad -principles are the same on both environments- but provided you can actually understand LV code, you'll have to translate it to the other language afterwards.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 6
(2,712 Views)

Thanks for the reply!

That was my first thought as a solution as well, and maybe that itself is where I am doing something wrong.  I am never able to start two counter based tasks at the same time, every task can only have a single channel and if I attempt to start a second task, I get an error that the resource is in use.

0 Kudos
Message 4 of 6
(2,700 Views)

Hi Mande - What counters and terminals are you trying to use on your device for each task? How are you setting these in LabVIEW?

 

Also, are you using a program you wrote yourself or an example program in LabVIEW?

Adena L.
Technical Support Engineer
National Instruments
0 Kudos
Message 5 of 6
(2,688 Views)

I'm not sure what I was doing wrong at first, but I eventually got more than 1 counter task running at a time.  They have to use the same reference timebase, but at least I can get 4 counter tasks going at the same now.

 

Thanks for the push to keep poking.

0 Kudos
Message 6 of 6
(2,685 Views)