Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

counting finite output pulse

Hi,
 
I am sure this question has been asked before but I have searched and cannot find it.
 
I am generating a finite pulse train for lets say 750 samples in my 6071E.  I need the program to show which count my counter is on, however, as it counts.  How do I do this? 
 
Thanks,
Chris
0 Kudos
Message 1 of 3
(4,056 Views)
Hi Chris,

While the DAQmx driver doesn't explicitly expose which pulse of the pulse train it is currently generating, you can determine it using a property node and some simple counting code. The property Counter Output : General Properties : More : Output State Property returns current output state of the counter as two different integers: 10192 for high and 10214 for low [1]. Based on how many times this property has changed, you can calculate how many pulses you've generated.

[1] LabVIEW Help, Counter Output : General Properties : More : Output State Property
Property and Method Reference » NI-DAQmx Properties DAQmx Channel » Counter Output » General Properties » More » Output State
Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 2 of 3
(4,033 Views)

There's another possibility that requires more manual configuration to generate the finite pulse train.  However, it can be used for pulse train freqs that are too fast for the software polling suggested earlier.  Be aware that it requires a relatively advanced use of the counters that'll take some learning curve time and effort.

The way finite pulse trains work "under the hood" is that one counter generates a single "gating" pulse and the other counter generates pulses only while that gating pulse is active.  The DAQmx driver figures out the right duration for the gating pulse so that its active time produces the requested # of pulses.

You can also do this by configuring the 2 counters separately to perform the same function.  By doing it this way, you'll have a separate task handle referring to the gating pulse counter, which you can use to query its "progress".

Another little factoid about pulse generation: the internal count register is alternately loaded with countdown values representing the low time and high time of the pulse.  Each edge at the counter's source (usually an internal timebase such as 20 MHz) causes the internal count register to decrement.  When it reaches the terminal count, 0, the output toggles state and the count is reset to the other countdown value.

So if you configure your gating pulse counter for an extremely short low time like 1 usec, then by the time you can make the software calls to start the task and query the count register, it'll be doing the countdown of its high time.  Your knowledge of the timebase used, the max countdown value and the present count value and the other counter's pulse train freq can all be used together to determine how many pulses have been generated.

-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 3 of 3
(4,017 Views)