Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with frequency measurement using NI 9401 module

Hi Everyone,

 

New to this board, I'm having a couple of problems in our labview development.

 

A bit of context : we're trying to do some data acquisitions and display on some analog inputs (Pressure NI9205 / Temperature NI9213) and some frequencies (through a NI9401).

P and T° are sampled at 100Hz though I plan to turn it down to 20Hz.
Frequencies can go from 100Hz to 9000Hz for one counter and from 0,5Hz to 80Hz for the other. They are sampled... well, when they can!

I'm using Labview 2017 under Win 10.

 

  • 1st problem :

While the T° and P seem to work well, the frequencies are giving me a hard time and have quite a weird behaviour.

Even under the test panel of NI Max, the results I get are a bit off from the real signal and also seem to glitch every now and then.
For example : I have 3242Hz on PFI1 and I'm trying to measure that frequency. The acquired / display data will show 3400Hz and will sometimes glitch to 4000Hz or even a super high frequency.

I've tried putting a digital filter on it with a 6,425e-6s minimum front but that didn't change anything.
Moreover, the real signal is pretty clean and when measured with a simple frequency meter is rock solid and precise to the 1/10Hz.

 

I would tend to think that this is a soft problem but then again, the NI-MAX test panel shows the same kind of behaviour...

 

  • 2nd problem

On another front : there is also a sync / acquisition speed problem with these frequencies.
I.E : in order to have these frequencies "sync'ed" with the T° and P that I sample at 100Hz, I would like to also write them at 100Hz even though I have no new measurement available.


In order to do so, I put a shift register on the while loop and a condition structure that just writes the previous measurement if no new one is available (and also cancels the error and writes a 0 in case of no signal at the input / timeout).

 

Problem is that I still only record about 100 times less frequencies points than T° and P.
The 100 number is not precise though so no conclusion to jump to on this.

For example : In a TDMS, I have 115000 T° and P points but only 1750 points of frequency 1 and 1375 points of frequency 2.

 

Well, I think I've covered most of it.
An extract of the VI is enclosed. 

 

Hope that rings a bell to someone!

 

Thanks for your help,

 

Marc

 

0 Kudos
Message 1 of 3
(2,540 Views)

Hi everyone,

 

A small detail that might not be so small : the labview I'm using is a 32bit version.

0 Kudos
Message 2 of 3
(2,509 Views)

What chassis do you use for housing the NI-9401 module? Your while loop does not have a timing constraint, so it might not always execute in the same time period. Also, maye the loop is not fast enough for the incoming signals. By implementing a shift register and deleting error codes for the other signals (temperature and pressure) the programm may get slowed down. Try to use a Timed Loop perhaps. It will enable you to monitor, if your loop finishes on time and will generate a flag, if the loop period is not finished in time ("finished late").

 

There are specific DAQmx blocks (pulse frequency/ width, counter) for measuring timing in signals. Take a look at these. If your hardware supports FPGA, then you can create custom labview VIs with MHz timing precision.

Best regards

 

 



0 Kudos
Message 3 of 3
(2,498 Views)