Calculator Program In Labview
LabVIEW is a graphical programming language, and it has powerful features for simulation, control and DAQ applications. Latest version of LabVIEW is LabVIEW 2019. LabVIEW is developed by National Instruments. Below we see a typical LabVIEW program. Design a calculator in LabVIEW that will add, subtract, divide, multiply, divide, take the square root, and raise to a power. Things to Consider. Should this program run one time or continuously? Do you want to press the Run button every time you need to calculate something? You should have only two inputs to the calculator. Create a reverse polish notation (RPN) calculator using LabVIEW. In RPN arithmetic the operators follow the arguments on which they they operate. For example to write the expression A sin (k x – ωt) in RPN one could write. K x. ω t. – sin A. Notice that in RPN no parenthesis are needed.
Create a reverse polish notation (RPN) calculator using LabVIEW. In RPN arithmetic the operators follow the arguments on which they they operate. For example to write the expression A sin (k x – ωt) in RPN one could write
k x * ω t * – sin A *
Notice that in RPN no parenthesis are needed. To implement this type of arithmetic on a calculator one uses a stack.
Values are pushed onto the stack from the top and then removed from the top of the stack as needed. This would be a LIFO (Last In First Out) type stack. We will use an array to serve as the stack. In the above example, the value of k would be placed on the stack and then the value of x placed on the stack. The * operator would remove the k and the x and replace these two values with the single value equal to the product kx. Notice that some operators (like sin above for example) will only take one value from the stack and replace it with an altered value.
You can learn how a RPN Calculator should work using a sample calculator application (depicted below) which is available for Windows or Mac OS X as an attachment at the bottom of this page.
Your version is to implement at a minimum the following:
- Ability to shut down the program by pressing the X in the top right of the application window. A confirmation dialog should be presented to allow the user to confirm the exit.
- Ability to enter a new value onto the stack by typing it into a register control.
- After a new value is placed on the stack the register should be cleared and the cursor should be placed back into the register control. To implement these features you will want to take a look at Property Nodes (especially Key Focus).
- Be certain that the width of the Stack and the width of the Register are adequate to fully display both large and small numbers in scientific notation.
- The stack operations buttons:
- DROP – Removes the top value from the stack (if it exists).
- DUP – Pushes a duplicate copy of the top value onto the stack.
- CLEAR – Clears the entire stack contents.
- SWAP – Swaps the two top values on the stack.
- The unary (one argument) operators: SIN, COS, TAN, ASIN, ACOS, ATAN, SQRT, LN, Degrees to Radians, Radians to Degrees, 1/x, x^2, e^x and +/- (changes sign of top of stack).
- The four binary (two argument) arithmetic operators (+, -, * and /). Others could be added like y^x for example.
- Constants such as Pi or e.
- The stack contents should be displayed on the front panel.
- The application should behave as expected if there are not enough numbers on the stack to perform the requested operation.
- The application should be written using an Event-Driven State Machine design pattern and you should make efforts to not repeat code unnecessarily (i.e. Attempt to group events that remove two elements from the stack and replace them with one together for example).
- There should be a button that will toggle the context-sensitive help window to show descriptions for the behavior of the front panel buttons.
- On shutdown the program should save the contents of the stack and the Angle Mode setting (if the extra credit is attempted) to a configuration file that is stored in the same directory as the application.
- On startup, the program should load the contents of the stack and the Angle Mode setting (if the extra credit is attempted) from the configuration file.
Demonstration Videos
The following is a video demonstration of how the RPN Calculator application should work.
The next video gives an overview of how to get started setting up the block diagram for the main application in an Event Driven State Machine design pattern.
Finally, this video gives a behind the scenes look at how to effectively group some of the buttons together to make the code easier to write along with some suggestions for how to interact with the configuration file.
Extra Credit
Of course LabVIEW, like most programming environments, expects angles given as parameters to trig functions to be in radians. As an extra credit opportunity, you can implement an Angle Mode setting that will allow the operator to change the mode between Degrees and Radians. This control could be an Enum (as in my example below) or could be a radio button. This setting will effect how the arguments to the trig functions SIN, COS, and TAN are treated and will effect the return values from the inverse trig functions ASIN, ACOS, and ATAN. If you implement this option, then the setting of this control should be stored and recalled from the configuration file as described above.
Here is a quick video that describes an alternative control that could be used to select the angle mode for the calculator.
Attachment
You can install a fully working version of the RPN Calculator application on your own computer so that you can test how different operations should work using the RPN logic. The link below is a ZIP file that includes an installer that will install the RPN Calculator on your computer and will create a shortcut to it on your desktop. Download this file and then unzip its contents. Inside you will find a file named install.exe
that will run the installer.
10 Labview interview questions and answers-Labview Questionnaire
This page describes Labview questionnaire written by specialists in Labview domain.This top 10 Labview interview questions and answers will help interviewee pass thejob interview for Labview programmer job position with ease.These questions are very useful as college viva questions also.
Project valkyrie fallout 4. There will be objective type of test with 10-20 questions with multiple choice questions in most ofthe interviews.
Question -1: What are two panels used in labview programming?
Answer -1: There are two types of panel viz. front panel and block diagram.Block diagram is the panel where all the programming is carried out. Front panel is the onevisible as user programmable interface i.e. GUI interface.
Refer Answer-1➤.
Question -2: What is shift register? How it is implemented in labview?
Answer -2: It can be used by right clicking 'for loop' structure in labview block diagram panel asshown below.
Question -3: What is the difference between local variable and global variable inlabview?
Answer -3:Local variable vs Global variable concepts➤
Question -4: How mixed data types are combined and passed from one file or place to the other in labview?
Answer -4: This can be done by creating cluster of choice.
Refer Cluster concepts in labview➤.
Question -5: What is the figure as shown below?
Answer -5: There will be multiple choices such as
Paint Window, Icon Editor in Labview, Property Window etc.
The right answer is Icon Editor.
Question -6: How I vs time, Q vs time, transmit power and power spectrum is plotted using labview.IQ data file with two columns have been provided as input data file.
Answer -6:Refer Answer-6➤.
Question -7: Write a simple labview program for binary number generator.
Answer -7:Refer Answer-7➤.
Question -8: Write a simple labview program for 2 to 4 decoder.
Answer -8:Refer Answer-8➤.
Question -9: Write labview programs for different types of flipflops such as SR,JK,T and D flipflop.
Answer -9:Refer Answer-9➤.
Labview Time
Question -10: Write a simple labview code for decimal to binary Converter.
Answer -10:Refer Answer-10➤.
This set of Labview interview questions and answers are useful for freshers and experienced level of job positions.
Top 10,12,15 Interview Questions and Answers
GSM Interview Questions and Answers
LTE Interview Questions and Answers
RF Interview Questions and Answers
Telecom Interview Questions and Answers
WCDMA Interview Questions and Answers
WiMAX Interview Questions and Answers
WLAN Interview Questions and Answers
Microcontroller Interview Questions and Answers
Electronics Interview Questions and Answers
Zigbee Interview Questions and Answers
IoT Interview Questions and Answers
Optical Interview Questions and Answers
DSP Interview Questions and Answers
Labview Interview Questions and Answers
MATLAB Interview Questions and Answers
VHDL Verilog Interview Questions and Answers
C C++ Interview Questions and Answers
Networking Interview Questions and Answers