Showing results for 
Search instead for 
Did you mean: 

Count pulses in analog waveform

Hello everyone,

I need to count the pulses of a analog waveform. I have a motor with a encoder, the encoder output analog waveform. I need to count the pulses to calculate the position of the motor. I didn't find something useful in LabVIEW. Does anyone can tell me to use which function?
Thank you in advance for your time and help
0 Kudos
Message 1 of 6

Try "Waveform peak detection" in the "Waveform --> Analog Wfm --> Measurements --> Wfm monitoring" palette.


Set the "Threshold" to a reasonable value, then see the size of the output array to get a count.

0 Kudos
Message 2 of 6

In addition, use "Extract Single Tone Information" in Signal Processing palette for frequency and period measurements.

LabVIEW 2017
LabVIEW Programming
0 Kudos
Message 3 of 6

Or, additionally to the good suggestions by Kyle and aputman, depending on the actual hardware you have you could do the counting in hardware.


Is your motor's encoder really outputting an analog waveform? I only know of encoders that do square waveforms. If you read it with an NI cDAQ module that has a counter module, you don't have to do it in software.

Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
0 Kudos
Message 4 of 6

LabVIEW is a development environment, you will need some hardware to give data to your program. 

Do you have any board, or do you need a board? WIth NI it would be simpler, third party just for this task will be cheaper.

What are the pulses shape, width, amplitude, maximum rate? Just in case, what is the noise level? 

Message 5 of 6

I have tried "Waveform peak detection" in the "Waveform --> Analog Wfm --> Measurements -->  Wfm monitoring" palette, but it does not do much.

With the code below it detects pulses only if the width is equal to 8. Why exactly eight- I do not know, the help doc did not give much reason.

With a real waveform from a DAQ it is much worse.

0 Kudos
Message 6 of 6