Example Code

LabVIEW Calculator

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 use an event structure to implement a calculator in LabVIEW.

 

Description

The calculator VI is a fully-functional calculator built in LabVIEW. This example demonstrates the following concepts:

  • Dataflow Programming
  • Modular Programming
  • While Loops
  • Case Structures
  • FGV
  • VI Documentation
  • Passing References
  • Property Nodes
  • LabVIEW Projects and Application Builder

Each time the user presses a button it is registered as an "event." Each type of event corresponds to a different case in the event structure, which implements the intended function. The "stored number" and "display number" are tracked via shift registers in an event machine, and the VI stops running when the running front panel is closed.

 

 

Requirements

LabVIEW 2012 (or compatible)

 

 

Steps to Implement or Execute Code

  1. Download the attached file "Calculator_LV2012_NI Verified.zip"
  2. Unzip the folder to your computer
  3. Open the "Calculator_LV2012_NI Verified.lvproj" file
  4. Open "Calculator.vi" and hit the Run button
  5. Perform desired calculations
  6. Close front panel when finished

 

Additional Information or References

Front Panel While Running

 

calc.jpg

 

Block Diagram

 

undefined

 

 

 

**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.

Comments
ReneW
Member
Member
on

I like this example. It gives me a lot of inputs.

syrpimp
Member
Member
on

seminal work.



Thank you & Best regards
syrpimp

=======================================================
“You must continue to gain expertise, but avoid thinking like an expert." -Denis Waitley
Shlok1229
Member
Member
on

Awesome work. But it would be better if it was a bit more open-sourced.

ChanMin
NI Employee (retired)
on

Thanks for your work!