Examples

NI Digital Multimeters Help (NI-DMM 18.1)

Edition Date: March 2018

Part Number: 370384V-01

»View Product Info
Download Help (Windows Only)

For NI-DMM example locations, refer to the NI-DMM Readme.

The following examples are instructional tools that demonstrate some of the functionality of the DMMs that you can use or integrate into your systems. These examples are available for the following ADEs:

  • NI LabVIEW 8.2.1 or later
  • LabWindows/CVI 7.1.1 or later
  • Visual C/C++ 6.0 or later
  • Visual Basic 6.0 or later

For examples of using NI DMMs with NI switch modules, refer to the NI Developer Zone Web site.

Note  Not all examples are available for Visual C/C++ and Visual Basic.

Single Measurements

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 Voltage

This example 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 Voltage

This example 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

This example 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

This example 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; 4-wire: NI 4050 not supported.)

This example 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 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 Frequency (NI 4050, NI 4065, and NI 4060 are not supported.)

This example 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

This example acquires a single diode measurement. Specify the range and absolute resolution of the input signal and the powerline frequency of your system. The current source is configurable for NI 4065 and NI 4070/4071/4072 devices. The measured value displays in the Measurement indicator. A Boolean control indicates if the measured value is out of range. The NI 4050 and NI 4060 use a constant excitation (2 V at 100 µA) for diode measurements. When using an NI 4050 and NI 4060, the configuration of the current source is ignored.

DMM Measurement

This example 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.

Measure Capacitance (NI 4072 only)

This example acquires a single capacitance measurement. Specify the range of the input signal and the number of measurements to average. The measured value is displayed in the Measurement indicator. A Boolean indicator shows whether the measured value is out of range.

Measure Inductance (NI 4072 only)

This example acquires a single inductance measurement. Specify the range of the input signal and the number of measurements to average. The measured value is displayed in the Measurement indicator. A Boolean indicator shows whether the measured value is out of range.

Multi Point Measurements

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

Acq&Graph Multiple Samples

This example acquires multiple measurements. Select the measurement function, range, and absolute resolution. Specify the number of samples to acquire. niDMM Read is used to acquire the requested number of points. The data displays in a waveform graph.

Cont Acq&Chart Multiple Samples

This example performs a continuous acquisition. Select the measurement function, range, and absolute resolution. 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 Acquisitions

These examples demonstrate the use of triggers during measurement acquisitions.

Acq One Sample-Ext Trig

This example 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

This example 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, absolute resolution and power line frequency. Specify the trigger source and the number of samples to acquire. Read Multi Point is used to fetch the requested number of samples.

Acq Multiple Samples-Ext Sample Trig

This example 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, absolute resolution and powerline frequency. Specify the sample trigger source and the number of samples to acquire. Read Multi Point is used to fetch the requested number of samples.

Cont Acq Multiple Samples-Ext Trig-Ext Sample Trig

This example 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, absolute resolution and power line frequency. 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

This example 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, Fetch retrieves the measurement and displays it in a waveform graph. The acquisition aborts when you click Stop.

Acq Multiple Samples-Interval Sample Trig

This example acquires multiple measurements continuously. The first measurement is acquired without a trigger. Each measurement thereafter is acquired when Send software trigger function is called. Select the measurement function, range, absolute resolution and power line frequency.

Note Note  NI 4080/4081/4082 is not supported.

Advanced Examples

These examples demonstrate some advanced features of the NI 4080/4081/4082 and NI 4070/4071/4072.

Improve Stability with Auto Zero (LV, CVI only)

Auto Zero improves the stability of a measurement by removing internal DMM offsets. This example acquires a DC voltage 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 (LV, 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 (LV, 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 (HI, 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 (LV, 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.

  1. Connect the supplied test leads to the input and drape the leads near a power cord.
  2. After specifying the instrument descriptor, select the 100 mV range.
  3. Select an aperture time of 10 ms.
  4. Set DC Noise Rejection (DCNR) to Normal.
  5. Note the displayed noise.
  6. Repeat with an aperture time of 16.67 ms (for 60 Hz powerline) or 20 ms (for 50 Hz powerline).
  7. Select a 100 ms aperture time and High Order DCNR.
  8. Note the difference in displayed noise.

LC Cable Comp Load and Measure (NI 4072 only)

Cable compensation improves the accuracy of a capacitance or inductance measurement by removing the parasitic capacitance (open compensation) and parasitic inductance (short compensation) from the system. This example shows how to load compensation values from a file and pick the correct compensation value based on the current source frequency of the configured measurement.

LC Cable Comp Measure and Save (NI 4072 only)

Cable compensation improves the accuracy of a capacitance or inductance measurement by removing the parasitic capacitance (open compensation) and parasitic inductance (short compensation) from the system. This example shows how to take compensation values for all possible current source frequencies and store them for later use and how to pick the correct compensation value based on the current source frequency of the configured measurement.

LC Cable Compensation (NI 4072 only)

Cable compensation improves the accuracy of a capacitance or inductance measurement by removing the parasitic capacitance (open compensation) and parasitic inductance (short compensation) from the system. This example shows how to load or save compensation values from or to a file and pick the correct compensation value based on the current source frequency of the configured measurement.

Self-Calibration

This example demonstrates how to perform a self-calibration and retrieve the calibration information from the NI 4070/4071/4072. Refer to the documentation for the recommended self-calibration interval. 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 Acquisitions

These examples demonstrate the NI-DMM waveform acquisitions functions that enable you to use the NI 4070/4071/4072 as a high-voltage isolated digitizer.

Read & Graph Waveform (LV, CVI only)

This example 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 (LV, CVI only)

This example 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 (LV, CVI only)

This example 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.

Waveform Demo (LV only)

This demo 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 NI 4070/4071/4072 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 Examples

These examples demonstrate the DC Reading Rates Specifications for the NI 4070/4071/4072.

Achieving 7 Digits of Resolution (LV, CVI only)

This example demonstrates how to achieve 7 digits of resolution by averaging multiple samples together. Connect a short between the HI and LO terminals of the NI 4070/4071/4072. Specify the input 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

This example demonstrates how to achieve the higher reading rate at 7½ digits of resolution with an NI 4071. Connect a short between the HI and LO terminals of the NI 4071. Specify the input 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 NI 4071 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 Rates (LV, CVI only)

This example demonstrates how to maximize DC reading rates for the NI 4070/4071/4072 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.

  1. Connect a short or very stable input signal between the HI and LO terminals of the NI 4070/4071/4072.
  2. Specify the instrument descriptor of the device.
  3. Choose the desired function and range.
  4. Use the Recommended Aperture Time Settings table to select an aperture time.
  5. Run the example.
  6. Click STOP to end the acquisition.

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 6.7 digits of resolution at around 100 readings/s.

By changing the aperture time to 100 ms, the resolution approaches 6.8 digits. This is 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 NI 4070/4071/4072. 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.

WAS THIS ARTICLE HELPFUL?

Not Helpful