LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

frequency measurement

My final test programs aquire waveforms that are basically square waves. We use scope cards for this because we also need to characterize the voltage levels as well as symmetry, etc.

Since the earliest days of when I inherited this process, we have fetched a 1D array of DBL for the waveform. That is, the element number is the sample number, and the element value is the voltage. If I take 100,000 samples, thats how big my array is.

I've been struggling with extracting the frequency information. I have a working solution but I don't like it. I put an extra Fetch down in the aquisition routine, but configured for WDT instead of 1D DBL. Then I can pop this into the Tone Measurement VI to get the frequency. The problem is, I have a lot of aquisitions, and the Tone Measuremnt VI adds some time. Also, I just don't like doing another fetch.

I thought I had a solution, see attached. However, the frequency result varies in strange ways as I change the sample rate. At 100mS/s and 20 mS/s, the results are very similar, but at 40 MS/s, its way off. I saved a data set at 100 MS/s and one at 40 MS/s.

I can't figure out why the Frequency VI won't cooperate. Any help?


~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 1 of 5
(3,401 Views)

Paul,

Is your scope card from NI?
If so, you will probably be able to use the NI-SCOPE library for programming it and this library has measurement functions.
For frequency measurement you may call the niScope_FetchMeasurement function. See the NI-SCOPE help for the usage of fetch functions.

Hope this helps.

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 5
(3,396 Views)
Yes, the fetch routines are all NI VI's, including ny attempts at frequency measurement. Apparenly the frequency VI's work well for wave forms with time information, but not so well when all that is aquired is a 1D DBL array of samples.

Forinstance, in the previously attached VI, would have thought that the result for the "Extract Single Tone Information (Not in Base Package)" VI would have been cycles per sample. Understandably a very small number (maybe that's the problem)

So, theoretically, If I multiply it by the sample rate, I should get the cycles per second. Unfortunately, it doesn't work well.
~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 3 of 5
(3,384 Views)
Hello Paul,
 
The "Extract Single Tone Information" VI needs some kind of timing information to be fed into it to get accurate frequency outputs.  The waveform data has time data associated with every element.  However, just an array of data has no kind of time data associated with it.  The element index is taken as the time, therefore the frequency output would not be accurate.
 
If it is not possible to acquire your data as a waveform directly, you can build the time data manually as well.  I do recommend to put waveform data as an input to the "Extract Single Tone Information" VI.
 
Hope that helps.
 
Regards,
Raajit L
National Instruments
0 Kudos
Message 4 of 5
(3,350 Views)
Hello Raajit,

Its all fine now. My problem turned out to be that I was setting the scope card for non-integer divisions of 100MS/s. Specifically, I was asking for 40MS/s, and using that number in converting my cycles per sample to cycles per second. The problem is, the scope card was defaulting back to the next valid rate (100 / 2 instead of 100 / 2.5).

Needless to say, my VI always worked for sample rates of 5, 10, 20, 25 and 100, but failed miserably at 40, and 30 and such.

For now, I'll just stay away from asking for non-valid rates.
~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 5 of 5
(3,346 Views)