10-11-2017 10:54 AM
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.
Any help would be greatly appreciated and I can provide more information if needed.
Thanks,
Dan
Solved! Go to Solution.
10-12-2017 05:06 AM
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.
However, comparing this to the frequencies read using the counter input, the signal is very shaky.
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
10-12-2017 05:46 AM - edited 10-12-2017 05:51 AM
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.
10-12-2017 07:35 AM
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.
10-12-2017 09:17 AM - edited 10-12-2017 09:19 AM
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.
10-12-2017 09:56 AM
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.
10-12-2017 10:07 AM
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
10-13-2017 02:57 AM
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.
10-20-2017 09:26 AM
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.
10-18-2021 08:42 AM
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.