Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Implement 'Implicit Buffered Read' using Ex VI 'Count Edges'

I am trying to implement Implicit Buffered Read (see image below) or page:

https://www.ni.com/docs/en-US/bundle/testscale-feature/page/counter-read.html

 

Labview 2021 SP1 Pro, cDAQ chassis 8189, 9402 dio module

 

I have a square wave begin generated (function generator) on pfi0 on the chassis.  Would pfi0 suffice as the 'counter timebase'?

I have another sqare wave signal coming in on the 9402, ch0, acting as my Signal to measure.

I'm using the Count Edges.vi from Example Finder.  The VI runs, but the counter value just spins, ie increases dramatically.

 

If I want to acquire in finite mode for 8 seconds, do I DAQmxStart, wait for 8 seconds, and then DAQmxRead, which will read the entire buffer?

 

Regards,

Gretchen

 

0 Kudos
Message 1 of 3
(1,262 Views)

It isn't clear what exact role you intend those 2 signals to play in your measurement.  Do you just want to count edges of one while using the other to set the timing for when you capture *samples* of those counts?

 

If so, check out the shipping example for "Counter - Count Edges (Finite Clock)".  Or possibly the "Continuous" variety, depending on the answer below.

 

As to "Finite Mode", that will be defined by a specific # of samples, not a specific period of time.   And the default behavior of a Read will be to *wait* for all those samples to accumulate before returning with them.

 

If you want 8 seconds worth of samples, regardless of how many that is:

1. Configure for Continuous Sampling, not Finite

2. In the call to DAQmx Timing, specify a "# samples per channel" that is easily at least 8 seconds worth.  This will make your acquisition buffer big enough to hold all the data at once.

3. After starting the task and waiting 8 seconds, wire the special value -1 to DAQmx Read to specify "# samples to read".  For a continuous sampling task, the -1 value means "give me all the samples available right now (that I haven't previously retrieved)". 

    Note that the same -1 value has a different special meaning for finite sampling tasks. There it means, "wait until the entire acquisition buffer fills up with samples, then return them to me."

 

I agree that some of this stuff is more confusing than it ought to be, hence this suggestion.

 

 

-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 3
(1,211 Views)

Thanks for responding, Kevin_P.  I have been working with NI Technical Support.

I also found a better article:  https://www.ni.com/en-us/support/documentation/supplemental/21/buffered-event-counting.html

When I have a solid solution, I will post.

Hope you find that new opportunity soon.

Gretchen (Skelly) Zimmer

0 Kudos
Message 3 of 3
(1,157 Views)