NI installs example code with NI-DMM that demonstrates the functionality of the PXIe-4081 and can serve as interactive tools, programming models, and building blocks for your own applications.

NI Example Finder

The NI Example Finder is a utility that organizes examples into categories and allows you to browse and search installed examples. For example, search for "DMM" to locate all NI digital multimeter examples. You can see descriptions and compatible hardware models for each example or see all the examples compatible with one particular hardware model.

To locate examples using the NI Example Finder within LabVIEW or LabWindows/CVI, select Help»Find Examples and navigate to Hardware Input and Output»Modular Instruments»NI-DMM (Digital Multimeters).

Installed Example Locations

Find the examples installed with PXIe-4081.The installation location for NI-DMM example programs differs by programming language and development environment. Refer to the following table for information about example program installation locations.

Table 19. Installed NI-DMM Example Locations
Software Application Installed Example Locations
LabVIEW Use the NI Example Finder to locate examples.
LabWindows/CVI Program Files\IVI Foundation\IVI\Drivers\niDMM\Examples\CVI
ANSI C or Microsoft Visual C++ Users\Public\Documents\National Instruments\NI-DMM\examples.

Common Example Programs

The following NI-DMM example programs demonstrate common DMM functions and operations.

Single Measurement Example Programs

These examples demonstrate how to take a specific type of measurement using the DMM. The default values for range and resolution are customized to the type of measurement. The following function calls are included in each example: niDMM Initialize, niDMM Config Measurement, niDMM Read, niDMM Close. Certain examples include additional function calls. For example, DC measurements sets the Powerline Frequency. AC measurements sets the AC Bandwidth.

  • Measure DC Volts—Acquires a single DC voltage measurement. Specify the range and absolute resolution of the input signal and the powerline frequency of your system. The measured value displays in the Measurement indicator. A Boolean control indicates if the measured value is out of range.
  • Measure AC Volts—Acquires a single AC voltage measurement. Specify the range, absolute resolution, and bandwidth of the input signal. The measured value displays in the Measurement indicator. A Boolean control indicates if the measured value is out of range.
  • Measure DC Current —Acquires a single DC current measurement. Specify the range and absolute resolution of the input signal and the powerline frequency of your system. The measured value displays in the Measurement indicator. A Boolean control indicates if the measured value is out of range.
  • Measure AC Current—Acquires a single AC current measurement. Specify the range, absolute resolution, and bandwidth of the input signal. The measured value displays in the Measurement indicator. A Boolean control indicates if the measured value is out of range.
  • Measure Resistance (2 or 4-wire)—Acquires a single resistance measurement. Set the measurement type to either a 2-wire or 4-wire resistance measurement. Specify the range and absolute resolution of the input signal of your system. The measured value displays in the Measurement indicator. A Boolean control indicates if the measured value is out of range.
  • Measure Frequency—Acquires a single frequency or period measurement. Specify the minimum expected measurement (in Hz or seconds) and the maximum amplitude of the input signal. The measured value displays in the Measurement indicator. A Boolean control indicates if the measured value is out of range.
  • Diode Test—Acquires a single diode measurement. Specify the voltage range, test current, and absolute resolution of the input signal of your system. The measured value displays in the Measurement indicator. A Boolean control indicates if the measured value is out of range.
  • DMM Measurement—Acquires a single measurement from an NI digital multimeter. Select the measurement function and range. Specify the resolution in digits of precision. The measured value displays in the Measurement indicator. A Boolean control indicates if the measured value is out of range.
  • Multi Point Measurement Example Programs

    These examples demonstrate how to use the niDMM Configure Multi Point. Only Immediate triggers are used.

  • Acq & Graph Multiple Samples—Acquires multiple measurements. Select the measurement function, range, and absolute resolution. Specify the number of samples to acquire. niDMM Read Multi Point is used to acquire the requested number of points. The data displays in a waveform graph.
  • Cont Acq & Chart Multiple Samples—Performs a continuous acquisition. Select the measurement function, range, and absolute resolution. Specify the number of samples to acquire. niDMM Initiate starts the acquisition. The requested samples are returned using niDMM Fetch Multi Point within the loop. The data displays in a waveform chart. The acquisition aborts when you click Stop.
  • Triggered Acquisition Example Programs

    These examples demonstrate the use of triggers during measurement acquisitions.

  • Acq One Sample - Ext Trig—Acquires a single measurement when an external trigger is detected. Select the measurement function, range and absolute resolution. Specify the trigger source and a delay that elapses between the trigger and the measurement. The measured value displays in the Measurement indicator. A Boolean control indicates if the measured value is out of range.
  • Acq Multiple Samples - Ext Trig—Acquires a finite number of measurements. The acquisition is initiated when a trigger is detected at the specified trigger source. All the points are acquired without a trigger. Select the measurement function, range, and absolute resolution. Specify the trigger source and the number of samples to acquire. niDMM Read Multi Point is used to fetch the requested number of samples.
  • Acq Multiple Samples - Ext Sample Trig—Acquires a finite number of measurements. The first measurement is acquired without a trigger, all remaining measurements are acquired when a trigger is detected at the Sample trigger source. Select the measurement function, range and absolute resolution. Specify the sample trigger source and the number of samples to acquire. niDMM Read Multi Point is used to fetch the requested number of samples.
  • Cont Acq Multiple Samples - Ext Trig - Ext Sample Trig—Acquires multiple measurements continuously. Every measurement is acquired when a trigger is detected at the Source according to the edge specified. Select the measurement function, range, and absolute resolution. Specify the trigger/sample trigger source and the number of samples to acquire at a time. niDMM Read Multi Point is used to fetch the number of points available or the number of points requested (whichever is larger).
  • Cont Acq Multiple Samples - SW Sample Trig—Performs a continuous acquisition. Each sample is triggered with a Software Trigger. Set the function, range, and resolution. Each time the Send Software Trigger function is called, niDMM Fetch Multi Point retrieves the measurement and displays it in a waveform graph. The acquisition aborts when you click Stop.
  • Advanced Feature Example Programs

    These examples demonstrate some advanced features of the PXIe-4081.

  • Improve Stability with Auto Zero (LabVIEW, CVI only)—Auto Zero improves the stability of a measurement by removing internal DMM offsets. This example acquires a DC voltage, DC current, or resistance measurement and returns the measured value to the user. After specifying the instrument descriptor, select the function, range, and resolution. Enable and disable Auto Zero and observe the difference in the measurement.
  • Eliminate V offsets with OCO (LabVIEW, CVI only) —Offset Compensated Ohms allows you to measure resistances in the presence of offset voltages. Offset Compensated Ohms is useful for resistance measurements of 10 kΩ or less. This example acquires a 2-wire or 4-wire resistance measurement. After specifying the instrument descriptor, select the function, range, and resolution. Turning on Offset Compensated Ohms enables this feature.
  • Improve DC Resolution (LabVIEW, CVI only)—To remove low frequency noise from a measurement, set the aperture time to 1/ f, where f is the noise frequency. Averaging multiple measurements together can further improve the resolution. This example acquires multiple DC voltage measurements. After specifying the instrument descriptor, select the function and range. Input a stable, known voltage or short the input terminals (Input HI, Input LO). Specify 100 ms for the aperture time and set the number of averages to 8. Note the resolution available. Change the number of averages to 1 and observe the decrease in resolution.
    Note Auto Zero must be enabled when averaging.
  • Improve DC Noise Rejection (LabVIEW, CVI only)—By varying the weighting of the samples that compose a single measurement, input noise can be attenuated. The DC Noise Rejection property controls the sample weighting. The signal frequencies removed from the measurement are related to the aperture time selected. This example acquires DC voltage measurements. The top graph in the VI displays the measurements. The second graph in the VI displays a plot of the theoretical noise rejection versus the frequency of the input signal.
  • SelfCal and Calibration Info (LabVIEW, CVI only)—Demonstrates how to perform a self-calibration and retrieve the calibration information from the PXIe-4081. The recommended self-calibration interval is every 24 hours or when the temperature changes more than 5 °C from last self-calibration. In this example, the self-calibration operation is timed to show the speed at which this operation can be performed. The calibration information stores both the date and the temperature at which the DMM was last calibrated. This information can be used along with the current temperature of the device (which is often different than the ambient temperature of the system) to determine if a self-calibration should be performed. This example times the self-calibration and displays the results. niDMM Self Cal takes approximately 60 seconds.
  • Waveform Acquisition Example Programs

    These examples demonstrate the NI-DMM waveform acquisitions functions that enable you to use the PXIe-4081 as a high-voltage isolated digitizer.

  • Read & Graph Waveform (LabVIEW, CVI only)—Acquires a waveform. Select the waveform acquisition function, range, sample rate, and number of points in the waveform. niDMM Read Waveform is used to acquire the requested waveform. The data is displayed in a waveform graph.
  • Fetch & Graph Waveform (LabVIEW, CVI only)—Performs a waveform acquisition that employs several iterations of niDMM Fetch Waveform. Select the waveform acquisition function, range, sample rate, total number of points in the acquisition, and the number of samples to fetch at a time. The requested samples are returned using niDMM Fetch Waveform within the loop. The data retrieved in each iteration of the loop is displayed in a waveform graph. The acquisition is aborted when you press the Stop button.
  • Triggered Waveform (LabVIEW, CVI only)—Performs a waveform acquisition that is started by a trigger. Select the waveform acquisition function, range, sample rate and number of points in the waveform. The requested samples are returned using niDMM Fetch Waveform. The data is displayed in a waveform graph.
  • NI-DMM Waveform Demo (LabVIEW only)—Acquires and displays the input waveform. Enter the instrument descriptor and click the Run button. While running, you can adjust the volts per division, and the timebase. You can use Simulate Flag to use NI-DMM to simulate the PXIe-4081 waveform acquisition mode. The timebase setting determines the acquisition rate of the instrument. The Acquisition rate indicator changes as you change the Timebase setting. The subroutine of the example analyzes the acquired data to locate the first positive zero crossing of the signal. If the routine finds the zero crossing, the example displays the waveform for (10)*(Timebase seconds). If the analysis does not detect any positive zero crossings, the graph displays data from the start of the acquisition buffer. This example and its block diagram source are available in the Waveform Acquisition folder of NI-DMM examples.
  • Performance Example Programs

    These examples demonstrate the DC Reading Rates Specifications for the PXIe-4081.

  • Achieving 7 Digits of Resolution (LabVIEW, CVI only)—Demonstrates how to achieve 7 digits of resolution by averaging multiple samples together. Connect a short between the Input HI and Input LO terminals of the PXIe-4081. Specify the instrument descriptor of the device. Run the example. DC voltage measurements are acquired on the selected range. The measured values are displayed in a graph. The Effective Digits of Resolution is calculated from the last 100 measurements and displayed in an indicator. The reading rate is also displayed. Click STOP to end the acquisition. You can change the aperture time, number of averages, and ADC Calibration settings. Run the VI to view the resulting Effective Digits of Resolution and Readings per Second for the specified configuration. Auto Zero must be set to ON when the number of averages is greater than 1.
  • Max DC Reading Rate at 7.5 Digits—Demonstrates how to achieve the higher reading rate at 7½ digits of resolution with a PXIe-4081. Connect a short between the Input HI and Input LO terminals of the PXIe-4081. Specify the instrument descriptor of the device. Run the example. DC voltage measurements are acquired on the selected range. The measured values are displayed on the front panel chart. The reading rate is displayed in an indicator. Click STOP to end the acquisition. To achieve the higher reading rate of 7½–digit resolution, the example configures the PXIe-4081 for 7½–digit measurements, turns off ADC Calibration, and directly configures Auto Zero to ON, the Number of Averages to 4, and Aperture Time to 1 power-line cycle (PLC).
  • Maximizing DC Reading Rate (LabVIEW, CVI only)—Demonstrates how to maximize DC reading rates for the PXIe-4081 by specifying the aperture time. Generally the DMM selects an aperture time to achieve a specified resolution, but in this example, you directly set the aperture time. The acquired measurements are then used to calculate the noise-free digits of resolution. Most traditional DMMs specify digits of resolution based on noise "counts" on a fixed display that defines the performance of the ADC. A more conservative approach is to calculate the effective resolution based on noise-free digits. You can use the example's calculation as a guide, in addition to the actual measured values, to determine the appropriate aperture time for a given measurement setup and conditions.
  • The measured value and reading rate are displayed in two indicators. The value for noise-free digits is based on the last 100 measurements and displayed in an indicator.

    Use this example to find the speed-noise tradeoff that works best for your application. On the 10 V range with a shorted input, a 3.33 ms aperture time yields approximately 6½ digits of resolution at around 290 readings/s. Increasing the aperture time to 10 ms results in approximately 7 digits of resolution at around 100 readings/s.

    By changing the aperture time to 100 ms, the resolution is 7.3 digits. This approaches the specified performance capability of the DMM before adding in other sources of noise (specified front-end noise on the most sensitive range, environmental noise, or noise from the device under test).

    Try making resistance measurements with a 1 MΩ resistor and a 10 ms aperture time, but connect the resistor with the standard unshielded test leads included with the PXIe-4081. Powerline frequency noise in the environment most likely will interfere with this high impedance test setup. Because 10 ms is not a multiple of a line cycle (50 or 60 Hz), the DMM does not reject this environmental noise. This is evidenced by the value in the Noise-Free Resolution indicator. Changing the aperture time to 16.66 ms (20 ms for 50 Hz line frequency outside the US) significantly improves the effective noise-free resolution. A 100 ms aperture time yields even better results.