08-02-2012 12:22 PM
Is it possible to measure the 2nd harmonic of the 5MHz Sine wave +/- 300mVp-p signal using NI-PXI 5124? If it is, could you show me how to do it.
Your help is much appreciated.
08-03-2012 05:12 PM
I don't know if this helps, but have you taken a look at the SCOPE Soft Front Panel? It's in Programs>National Instruments>NI SCOPE. That might be a good place to start. There are also some example LabVIEW VIs in that same directory.
Just a thought...
08-03-2012 05:44 PM - edited 08-03-2012 05:44 PM
The 2nd harmonic measurement is not a standard measurement available from the NI-Scope Soft Front Panel. You can use the available FFT view to get a sense of the magnitude of the 2nd harmonic.
You can perform this measurement using LabVIEW.
Try using the "niScope EX Configured Acquisition" example as a starting point. This can be found in the start menu at
Start->All Programs->National Instruments->NI-Scope->Examples->LabVIEW
You will want to change the "fetch" data type to WDT
Then add a "Harmonic Distortion Analyzer" to the block diagram at the output of the fetch block. This analyzer can be found under "Signal Processing"->"Waveform Measurements" pallete. (Accessable by right clicking on the background of the diagram).
This function will do all the work in detecting the fundamental frequency and the components of each harmonic. You will want to use an "index array" function to select the harmonic of interest, and then possibly display the result in a front-panel indicator or chart. The resulting block-diagram should look something like this:
Brian Alexander
Software Engineer
National Instruments
08-07-2012 11:22 AM
Hi Brian,
Thanks a lot for your reply.
Sorry, I forgot to mention that I have to program the 5124 under Visual C++
Are there sample codes in C++ that I can try.
TIA
08-08-2012 08:14 PM
The example Brian mentioned (Configured Acquisition) is available for Visual Studio C# or VB in the examples mentioned in this article. From what I can tell, there isn't a C++ version specifically, although there is a C version located at Start->All Programs->National Instruments->NI-Scope->Examples->c
08-09-2012 05:08 PM - edited 08-09-2012 05:10 PM
Your best bet for a good starting point is the NI-SCOPE help file.
Start->All Programs->National Instruments->NI-SCOPE->Documentation->NI High Speed Digitizers Help
In the help file, look under
Programming->Getting Started with NI-SCOPE->Creating an Application->Microsoft Visual C and C++
This will explain how to properly link the niScope libary into your application. The library is most likely located under C:\Program Files (x86)\IVI Foundation\IVI
There is an abundance of information on how to use NI-SCOPE in your application in this "Getting Started with NI-SCOPE" section. This section will also refer you to the C examples that should already be on your computer.
In terms of measuring the 2nd harmonic, you could use the included FFT computation using the array measurement function. You will want to use some form of:
Initialize (niScope_init)
Configure (niScope_AutoSetup or niScope_ConfigureAcquisition)
Initiate (niScope_InitiateAcquisition)
Fetch Array Measurement (niScope_FetchArrayMeasurement)
This will give you the FFT data. You can index into this data to determine the value at the desired frequency. You will need to use the data in wfmInfo to determine which index you need to use to index into measWfm. wfmInfo[0].xIncrement will give you the number of Hz between each index. That is, if xIncrement is 200, then the FFT magnitude for DC is at measWfm[0] and for 1 KHz it is at measWfm[5]. It may be helpful to look at the values at +/- 1 index from where you "think" the second harmonic should be.
Error Handler, if one occurs (niScope_errorHandler)
Close (niScope_close)
Alternatively, you just fetch the waveform as demonstrated in the "Configured Acquisition" example, then pass the acquired waveform data into a signal processing algorithm.
Please refer to the documentation that is in the help file to learn how to properly use NI-SCOPE. The Programming->Reference section describes all of the available C functions, and will be a necessary tool for your success.
Brian Alexander
Software Engineer
National Instruments