Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

USB 6218 acquiring voltage and counting pulses

Solved!
Go to solution

I am using the USB 6218 to run 2 NI task at  the same time in my vi. One task is acquiring a pressure transducer voltage and scaling it. The other task is count frequency pulses from a flow meter and scaling. Both task run fine when I run them in Max, or run them individually in my vi as a sub-vi. But when I try to run simultaneously I get erroneous reading from the counter. It seems like the counter is loosing its task after its first reading. Each task is written in its own sub-vi which takes one sample, and I am sure the task has stopped before the other task begins. I am not getting any errors, but I have to shut down and restart the computer to clear the counter task before it can start reading correctly.

0 Kudos
Message 1 of 3
(5,904 Views)
Solution
Accepted by topic author joe_n1

Hello joe_n1, 

 

It sounds like this issue is due to how you are using your tasks in subVIs.  If you create a task and then clear it each time, then each time the task will start out fresh.  As you put, it will lose its task after the first reading.  

 

To avoid this, make sure you are only creating the task once (generally at the beginning of your VI) and then clearing it once (generally at the end of your VI).  Really, the only thing you should be repeating is the actual DAQmx reads.  Because of this, I would not recommend putting your tasks into subVIs.  You should not have to stop each task before the other begins - rather you should be able to run them simultaneously.  

 

Patrick W.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(5,874 Views)

Thnaks for your responce! Your solution help!

 

0 Kudos
Message 3 of 3
(5,857 Views)