Example Code

Mini Calculator in LabVIEW

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.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview

This example shows how to implement a calculator based on software buttons, using the Event-Driven Producer and Consumer design pattern.

 

Description

The User Interface emulates a calculator keypad. These software buttons are triggered based on an Event-Driven Producer and Consumer design pattern and allows the user to add, subtract, multiply and divide two numbers.

 

Requirements

  • LabVIEW 2013 (or compatible)

 

Steps to Implement or Execute Code

  1. Run Calculator 2013 NIVerified.vi
  2. Use the keypad to add, subtract, multiply and divide two numbers.
  3. For example, you can click the following software keys in the following order:
    1. Click "1"
    2. Click "+"
    3. Click "3"
    4. Click "E"
    5. Notice that the result is 4, which is 1 +3
    6. Click "C" to clear the calculator input
  4. Press the "Stop Button" to exit the program.

Additional Information or Resources

VI Block Diagram

Capture.JPG

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

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