Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

cDAQ 9178 simultaneous counters independant loops?

Solved!
Go to solution

I have a cDAQ 9178 in which I'm scanning in various channels, mostly analog, as well as sending single digital outputs. These tasks are started at program runtime and basically scan continuously, filling variables as needed.

 

In addition to this, I needed to count some pulses and the only way I got it to work was to start the counter task when needed, then to stop it. This is going on in parallel (inside a state machine) and works fine.

 

Now I want to add a second counter, which will run when needed (same scenario, start task, read pulses, stop task).


So in summary I'll have :

 

Main while loop analog inputs, digital outputs, tasks started before main while loop and run continously, tasks stopped only after program stops. (works fine)

Counter task started when needed, stopped when needed, from within main while loop. (works fine).

2nd Counter task to start when needed.. (wondering if this will work)?

 

Should this be a problem?

 

Jeff

 

 

0 Kudos
Message 1 of 6
(3,777 Views)
Solution
Accepted by topic author jeff_scharpf

Hi Jeff,

 

I don't believe that you will run into any issues with this.  To test this, I took a counter measurement example and duplicated it - creating two tasks, each using one counter from the same device and I didn't run into any errors.  This said, the best way to verify this for your application would be to add a simple second task and test it.  As long as this works, there shouldn't be any trouble even though your final setup may be much more complex.

 

Regards,

Trey C.

0 Kudos
Message 2 of 6
(3,767 Views)

Thanks Trey I'll give it a shot!

0 Kudos
Message 3 of 6
(3,759 Views)

Trey I'm having a problem. The tasks seem to work fine (they don't cause problems with each other) but there is a problem in the counter.

 

I have code that sets each channel to a counter, so I have two tasks, one is using cDAQMod3/ctr0 and the other using cDAQMod3/ctr1. These are two channels on a 9421 module.

 

The problem is that the first one works fine (counts), the second one doesn't count. If I go to MAX I can get both to work ok but I have to assign ctr1 to PFI1.


I don't see anywhere in Labview where I can tell ctr1 to use PFI1.  Does this make sense?  I'm using the create task, CI Cnt Edges. There is no option to select PFI, only ctr.

 

 

0 Kudos
Message 4 of 6
(3,745 Views)

Ok nevermind I just connect to input #4 and ctr1 works fine 🙂

 

0 Kudos
Message 5 of 6
(3,742 Views)

Hi Jeff,

 

As you've discovered, you need to select a terminal for your count edges task and it is not not exposed on the create channel VI.  After your create channel, insert a DAQmx Channel Property Node.  Select Counter Input->Count Edges->Input Terminal.  Set that terminal to your desired digital line.

 

The device pinout, accessible through MAX or the DAQmx help, lists the default terminals for each counter.

 

 

0 Kudos
Message 6 of 6
(3,741 Views)