Example Code

Perform Bode Analysis Using NI-SCOPE and NI-FGEN

Code and Documents

Attachment

Overview


This example program illustrates how to use modular instruments devices to perform a Bode analysis on a circuit, using an NI-FGEN device to generate a waveform and an NI-SCOPE device to measure that signal after it passes through a circuit under test.

This VI shows how to use a function generator and a high-speed digitizer to perform a Bode analysis on a device under test. A function generator is used to generate a sine wave of a varying frequency. The digitizer acquires the raw generated signal and also the signal after it is passed through a device under test, such as a filter. The amplitude and phase of the original and altered signal are compared. The results are displayed over the range of frequencies tested. This type of analysis can be used to characterize how a device under test attenuates or phase shifts an input signal across a wide frequency range.

Front Panel Configuration:

Select the resource names for the function generator and digitizers in the resource name drop-down boxes.  Connect channel 0 out of the function generator directly to the channel 1 in of the digitizer device.  Also connect the channel 0 out of the function generator through the device under test and into channel 0 of the digitizer device (see the diagram on the front panel of the VI for more details).  Click the Run button to begin the test.

Block Diagram Steps:

  1. Initialize and configure the function generator device using the NI-FGEN VIs.
  2. Initialize and configure the digitizer device using the NI-SCOPE VIs.
  3. Start the function generator at a certain frequency.
  4. Read the signal being generated by the function generator directly on channel 0 and after passing through the circuit on channel 1.
  5. Compare the amplitude and phase of the signals using the Tone Measurements Express VI.  Plot the results on the Gain and Phase plots.
  6. Increase the frequency of the function generator and repeat steps 3-5.
  7. Close all instrument sessions and check for errors.

Input / Output Connections:

  1. Connect channel 0 out of the function generator directly to the channel 1 in of the digitizer.
  2. Connect channel 0 out of the function generator through the device under test and into channel 0 of the digitizer.

     

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors