LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with labview calculations

Hi all, we have looked for help on this before and recieved some insightful feedback - however, we are having difficulty with this coming to an end. We are very new to Labview over here, and would like to:

 

Finish entering the decimal functionality

Adding the operators to the calculator

Adding the Equals and Clear

 

Many many thanks. 

0 Kudos
Message 1 of 8
(2,814 Views)

It is not clear what question you are asking.  If the question is really "Finish our Class Assignment for us", please provide the complete wording of the Class Assignment (so we can "get it right" -- maybe we can even get some Course Credit ...).  If you want specific help on the code you provided, explain what the code is supposed to do, and what (one) additional thing you want it to do, but cannot figure out.

 

BS

0 Kudos
Message 2 of 8
(2,791 Views)

You probably need to read about Event Structure, for example at these two links: Event Structure and Event-Driven Programming in LabVIEW.

 

And here is an example of a LabVIEW Calculator project

0 Kudos
Message 3 of 8
(2,781 Views)

My partner and I are attempting to become better at Labview and would like to make a calculator that looks similar to the windows calculator. 

 

We have most of the logic down for the calculator to work, and our mentor is not available this week. We are not sure how to complete the calculator further than what I provided, as adding in the decimal, operators and clear functions are beyond our skillset. We were hoping someone would show us how to finish this, as it is basically almost there.

 

Thank you!

0 Kudos
Message 4 of 8
(2,768 Views)

This is actually not a bad project to learn something about programming with LabVIEW.  As you've already discovered, it is not a trivial task, but involves multiple "features" of LabVIEW that are worth learning for their own sake.

 

One is the concept of an Event structure and how to use it to handle "virtual calculator key" presses.  Related to this is the concept of a State Machine.  For example, if you just pushed "1", you could be considered to be in a "Numeric Entry State", where you want to translate the key press into a decimal number and add it to an existing "number in the calculator".  If you pressed the "+" button, you might want to switch to an "Operator" State.  Note that I'm vastly over-simplifying here -- you need to think carefully about what you want to do, and what "State" the calculator should be in, when keys are pressed.  Usually pressing an Operator key would have, as a side effect, "operating" on the number.  Note that you might need a concept of "memory" (in LabVIEW, this is, in many cases, a Shift Register) to hold numbers on which you then do "operations".

 

Here's a simple exercise for you to contemplate -- if I've already pressed "1", then "2", and your code has done the "logical" thing of creating somewhere the number 12, what should happen if I press the "3" key?  What should happen if I press the "." key, and then the "3" key?  Think about it, do some playing with pencil and paper, then start coding.

 

P.S. -- when I took a brief (!!) look at your code, it wasn't clear to me that if I did press "1" then "2" that you would have 12 stored anywhere.  Maybe I didn't look hard enough ...

 

Bob Schor

0 Kudos
Message 5 of 8
(2,752 Views)
Thank you for the input. Our program calculator does indeed recognize numbers when they are entered in, as many digits as you want, and it recognizes that it's a number. It just doesn't run at the moment because we have not completed the operators and decimal functions. This is what we needed help completing!
0 Kudos
Message 6 of 8
(2,742 Views)

Look at the calculator example that was mentioned.

 

Take the advice by working it out on paper in a flowchart format.

0 Kudos
Message 7 of 8
(2,740 Views)

This is going to sound harsh, but...  the first step would be to take the advice given last time you posted this question.  If your goal is to have it written for you, ask that.  But don't pretend like you want to learn and then ignore good advice.

 

http://forums.ni.com/t5/LabVIEW/Creating-a-Calculator-similar-to-MS-calculator/m-p/3120294

 

Message 8 of 8
(2,721 Views)