LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Gated Event Counting Using Daqmx

On a 6602 card...  I'm trying to gate counter 1's output to counter 0's pulse using Daqmx in Labview. 
 
I tried to use Daqmx connect terminals.vi to connect the output of counter 1 (PFI 32) to Gate 0 (PFI 38), but it gave me an error...  Is there any example codes out there that show me how to gated a series of counters off of the output of another counter.  Please help.
 
Thanks,
Waymon
 
 
0 Kudos
Message 1 of 6
(3,548 Views)

DAQmx has introduced some new terminology for counter operations, but has also provided greater flexibility and simplicity in routing the timing signals.

In your case, "gated event counting" would now be known as "Edge counting with a digital Pause Trigger."  I'm not near a LV machine to check, but there may be a shipping example to illustrate. 

Roughly, here's how you'd approach it:  With Ctr0 as the edge-counter, you would put a DAQmx Trigger Property node in the config chain.  If you dig through the options, you'll find properties that help you define a "Pause Trigger."  You'd be wanting to define things like trigger type = Pause trigger, trigger source / terminal = Dev1/Ctr1InternalOutput, pause when = low (or high).  Sorry, I don't recall the exact names...

I think the 2 key points are that "gated" operations are configured as "pause-triggered" operations, and that you can easily specify the use of an internal board signal like Ctr1InternalOutput to be the trigger without concerning yourself with PFI pin #'s.

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 6
(3,542 Views)
Hi Waymon,

Kevin's suggestions should put you on the right track.  The specific DAQmx shipping example that does the gated event counting can be found in LabVIEW by going to Help»Find Examples, then browsing Hardware Input and Output»DAQmx»Counter Measurements»Count Digital Events»Count Digital Events-Pause Trig.vi.  Under Trigger Parameters on the Front Panel, you can specify what signal you actually want to use for your "gate" or "pause trigger."  You will notice that it lists your PFI lines for your device, but you can actually find a signal called /Dev1/Ctr1InternalOutput like Kevin mentioned.  This way, you don't have to worry about the specific PFI line number, and the DAQmx driver takes care of the internal signal routing for you.  Let us know if this helps!

Thaison V
Applications Engineer
National Instruments
0 Kudos
Message 3 of 6
(3,538 Views)

Hi Thaison and Kevin,

 

Below is the code that I generated, can you please point out my mistake?  In the code, I first generated a continuous pulse and then try to gate that output with counter 1.  I tried to follow the example you mentioned as close as I can.  However, still no luck gating the output of counter 0 and counter 1.

 

Please help

 

Thanks,

Waymon

 

 

 

0 Kudos
Message 4 of 6
(3,526 Views)
Hi Waymon,

Did you take a look at the Count Digital Events-Pause Trig.vi shipping example I mentioned?  This should have the exact code that you are trying to implement.  I am not sure how your application is supposed to work exactly from the code you provided.  You are setting up the parameters, but you never actually start the task or begin reading from the counter itself.  This is all done in the
Count Digital Events-Pause Trig.vi.  Have you tried running that example?  Let us know if you have tried this and are still running in trouble.

Thaison V
Applications Engineer
National Instruments

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

Hi Thaison,

Thanks for your help, I finally figure it out.  The reason it didn't work is because I was using refrence Trig Type instead of Pause. Trig Type.  🙂

Thanks for your help again.

Waymon

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