LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Determine when Counter Pulse Generation has been digitally triggered to start

A counter task has been configured for continuous pulse generation with a digital edge start.  How in LabVIEW can I determine when an external digital trigger has been received and the counter started ?  It seems that a timed loop with DAQmx Create Timing Source wired to its source could be made to work but I cannot figure out how or the most appropriate instance to use.  I would simply stop the timed loop once the counter start had been detected.
 
Steve
 
0 Kudos
Message 1 of 4
(2,842 Views)

Hi Steve,

You can use a DAQmx property node to determine when the counter output has begun. Use the Counter Output.OutputState (see picture), which will tell you the level of the counter, and look for a change in state to determine when the counter has begun.

David L.
Systems Engineering
National Instruments
0 Kudos
Message 2 of 4
(2,823 Views)

Thanks David, that's easier than using a timed loop.  I see that DAAQmx Channel > CO.OutputState has values of 10192 for its High state and 10214 for its Low state.

I also notice that CO.Count initializes to 1 when the counter is waiting for an external trigger and then begin counting from there once triggered.

Steve

0 Kudos
Message 3 of 4
(2,815 Views)
Querying the output state and looking for a change would probably work for many typical square-like pulsetrains.  If you have an extreme duty cycle like 1% or something though, your queries are likely to keep finding the counter in the same output state long after pulses have started.
 
Some other ideas of a similar nature may work better, though I'm not near a LV machine to test them.  I can vouch for idea #1 from past usage though.
 
1. Query the counter's 'count' property and look for a change.  You're pretty unlikely to query the same count value several times in a row during pulse generation.
 
2. You could try querying the DAQmx property for "TotalSamplesGenerated" and look for a non-zero value.  I'm not sure if this gets updated for counter outputs though.
 
3. Counters also have a property called "TC reached?" where TC means terminal count.  When you query and get a True, It automatically resets itself back to False until reaching TC again.  Again, while I know this works for counter input tasks, I'm not sure if it gets updated for counter outputs.
 
-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 4 of 4
(2,815 Views)