Example Code

VirtualBench: DMM Measurements With the DMM

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • VirtualBench All-in-One Instrument

Code and Documents

Attachment

Description

Overview
This example automates one of the following measurements with the VirtualBench digital multimeter (DMM): DC or AC voltage, DC or AC current, resistance, or diode testing.


[+] Enlarge Image

Steps to Run Program

    1. Download the example program on the right under downloads.
    2. In LabVIEW software, open the program by going to File » Open… and navigating to the file.
    3. Connect the VirtualBench device.
    4. Select the correct VirtualBench device by in the pull-down menu of the VirtualBench Device control.
    5. Specify the measurement type to be taken in the Measurement Type control.
    6. Click the Run button to take measurements.
    7. The measurement will display in the Measurement Values indicator in the Acquired Data panel.
    8. Click the Stop button to end the program.

 

Program Explained

 


[+] Enlarge Image

 

    • Initialize Session
      • A new session to the DMM is initialized by passing the VirtualBench device information from the VirtualBench Device control into the DMM Initialize VI.
    • Configure Instrument
      • Instrument and error information are passed into the DMM Configure Measurement VI. Measurement type is passed from the Measurement Type control into the VI, and auto-range has been turned on using a Boolean true constant.  
    • Perform Operation
      • As indicated by the While Loop, this program takes multiple read measurements.
      • The instrument and error information are passed into the DMM Read VI. This VI then outputs the measurement to the Measurement Value indicator.
      • The error wire is then unbundled to determine the status. This information is then passed through an OR with the state of the Stop button into the conditional terminal of the While Loop. If either an error has occurred or if the user clicks the Stop button, the While Loop will finish executing.
      • A 100 ms Wait has been added and will be performed after every read. While Loops are designed to  execute as fast as possible, but this can take up a lot of processor resources. The Wait is added to prevent  unnecessary use of computing resources.
    • Close Session
      • The instrument and error information are passed out of the While Loop and into the DMM Close VI. This closes the DMM session and deallocates any resources for the next time a session is created with the DMM.
    • Handle Errors
      • Finally, the error information is passed into the Simple Error Handler VI. If an error has occurred, a dialog box will open to notify the user.

 

Additional Resources

 

VirtualBench Examples

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