04-18-2015 10:35 AM
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.
04-18-2015 01:00 PM
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
04-18-2015 01:29 PM
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
04-18-2015 01:49 PM
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!
04-18-2015 03:21 PM
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
04-18-2015 04:04 PM
04-18-2015 04:09 PM
Look at the calculator example that was mentioned.
Take the advice by working it out on paper in a flowchart format.
04-18-2015 06:01 PM
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