LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital Pulse Measurement without Counter

Solved!
Go to solution

Hi all,

 

I'm using several flowmeters that generate a digital pulse and using LabVIEW to convert frequency to flowrate. I'm using an NI-9474 digital I/O module with a CompactDAQ chassis that has two counters. Normally I would use these counters to read these pulse signals but I am already using them to generate pulses for PWM. Instead, I am trying to measure the pulse via one of the digital input channels without the counter. 

 

The signals are low frequency, max 100Hz. I've managed to count the pulses using an analog voltage input before using the 'Pulse Measurements' VI and it worked well. My thinking this time was that I could convert the digital waveform from the digital input into an analog waveform and use the Pulse Measurements VI to do the same task. However, when I try and do this the VI just outputs zero as the pulse frequency. I've attached the code for both the analog and digital pulse measurements below. 

 

Analog Frequency Measurement.pngDigital IO Pulse Measurement.pngAny help would be greatly appreciated and I can provide more information if needed.

 

Thanks,

Dan

0 Kudos
Message 1 of 10
(7,325 Views)

I've found a way to do it by creating an array of 1000 elements and wiring it to a shift register to act as a buffer. I use the array to build a waveform using the Build Waveform VI and then use the Pulse Measurement VI in order to obtain the frequency.

Digital Frequency Measurement FORUM.png

However, comparing this to the frequencies read using the counter input, the signal is very shaky.choppyfrequency.png

 

Can anyone recommend a way to improve the quality of the reading? Also, is using the counter of a DAQ the best way to measure low frequencies? I've notice it gives no readings below 20Hz.

 

 

Thanks in advance!

Dan

0 Kudos
Message 2 of 10
(7,277 Views)
Solution
Accepted by topic author GrassNinja

It is necessary to increase the sampling frequency, using continuous reading, rather than one value. With continuous reading, the board's clock generator is used, now the measurement interval depends on the cycle time. The more measurement points there are between pulses, the more accurate the calculations will be.

It is not necessary to read one point at a time. Read 100 points, with a sampling frequency of 100 times more. The measurement interval will remain the same, and the accuracy will increase by two orders of magnitude.

Labview 4.0, 5.0, 6.1, 8.6, 2009, 2011, 2012, 2014
If you do not know something, ask me.
0 Kudos
Message 3 of 10
(7,273 Views)

Hi Borjomy, thanks for your reply. When I set up the task I tried to use the DAQ Timing VI to set the sample frequency and number but I got an error saying that the only valid timing method is 'On Demand'. Do you know how I can read multiple samples and change the frequency when the task is a digital input? Thanks.

0 Kudos
Message 4 of 10
(7,260 Views)

It's strange that this module allows only the "On Demand" mode. The output time of the module is 1 μs. Probably, on the cRIO platform in FPGA mode this speed is available. But at you DAQ ... It is possible to try to remove a delay in 1 ms and to measure time between measurements (in ticks). Then you will have two sets of data: the pulses and the times between the measurements. Knowing the position of the pulses in the array, you can calculate the time between them, summing the corresponding intervals.

Labview 4.0, 5.0, 6.1, 8.6, 2009, 2011, 2012, 2014
If you do not know something, ask me.
0 Kudos
Message 5 of 10
(7,245 Views)

Sorry, I typed the wrong module number. We will be using an NI-9375 to read the pulses. However, I have been testing the code using the digital input of a USB-6211 module. Do you think when I test the code on the 9375 it should work? Thanks. 

0 Kudos
Message 6 of 10
(7,239 Views)

If Ni-max allows you to create a continuous reading task for this module, then of course! The only question is whether there is enough performance to calculate the pulse parameters by a standard function at a high clock frequency. It may be necessary to write your own simplified version of the frequency calculation

Labview 4.0, 5.0, 6.1, 8.6, 2009, 2011, 2012, 2014
If you do not know something, ask me.
0 Kudos
Message 7 of 10
(7,233 Views)

OK, when the 9375 arrives next week I'll test it out and let you know. Thanks by the way, I really appreciate your help on this.

0 Kudos
Message 8 of 10
(7,223 Views)

OK, I finally tried it with the NI-9375 and it works really well! The signals match closely.

Thanks very much for your help Borjomy.Digital Frequency Comparison.png

0 Kudos
Message 9 of 10
(7,196 Views)

hi GrassNinja, I also meet the problem, i need to measure the digital input TTL waveform , the high level numbers, but i don not how to measure it, can you please help me? How do you solve the problem? like labview code? 

Thank you very much.

0 Kudos
Message 10 of 10
(3,122 Views)