LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculator using LabVIEW

I'm trying to create a LabVIEW calculator using OK buttons instead of using increment/decrement buttons. I'm trying to avoid using the Event Structure. Is there any suggestions anyone has to get me started?

0 Kudos
Message 1 of 6
(3,247 Views)

Hi all,

 

I'm pretty new to LabVIEW and I'm having trouble figuring out how to store the data entered into the display. Below I attached what I have so far. For example, for case 1 I am trying to have the display show a 1 and store that value. Any ideas?

0 Kudos
Message 2 of 6
(3,267 Views)
0 Kudos
Message 3 of 6
(3,245 Views)

First, use Block Diagram cleanup to clean up those wires.

 

Second,  make sure you have something going to those tunnels in every case of the case structure.  That might be nothing but a wire passing a value through unchanged.  Right not your VI is not executable because of the unwired tunnels.

Message 4 of 6
(3,160 Views)

Thanks for your input. I fixed it a bit, but when I run the program the numbers do not display. Although, if I press 1+1 then the equal sign then I hit the STOP button, it will display a 2. It doesn't seem to work for any other operator though.

0 Kudos
Message 5 of 6
(3,135 Views)

Hi yesyes,

 


@yesyes123 wrote:

but when I run the program the numbers do not display. … then I hit the STOP button, it will display a 2.


THINK DATAFLOW! is the basic principle of LabVIEW: your "string" indicator will only show data when the loop has finished…

 

Also you can invert the loop stop condition so you don't need this extra NOT operation.

Why is the constant wired to the timing function orange, when the function expects a blue U32 datatype?

You also allow only one-digit numbers as you overwrite previous values in the shift register(s): simple/cheap calculators usually allow upto 10 digits…

Using an event structure would allow much easier code…

Button "2" and "3" are exchanged in your cluster (see its element order!), so your case structure will give wrong results for those 2 inputs. Even worse: those buttons are labelled incorrectly, but the code does the required operation. So your code documentation is bad! Again: an event structure would allow for much easier code…

 


@yesyes123 wrote:

It doesn't seem to work for any other operator though.


Because you don't parse those inputs correctly as far as I can see in your code. Addition only works because it is set as default operation…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 6
(3,132 Views)