LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple use of the Indicator terminal

I've developed a working calculator in LabView and for each of the mathematical operations on the two number control terminals, the result gets displayed on the separate indicator terminal for that particular operation. I've a final indicator terminal that is visible on the front panel, and it should show the result of the operation from the individual indicator terminals, if any of them has a true value. But the final indicator terminal doesn't work. I would like to know how can a result be displayed on the final indicator terminal for any of the operations being true. I've tried to build an array of each of the individual indicator terminals and I search the array for any indicator having a valid result and try to show it on the main indicator terminal, but it doesn't work. Kindly help me out.
0 Kudos
Message 1 of 4
(2,533 Views)

Hi Suhail,

      Please attach your VI so we can help you with it!  From the description you've provided, it sounds like a button-event driven logic could help organize your code.  If its clear when display needs to be updated, it should be easy to update a single "final indicator". Smiley Happy

Cheers!

 

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 2 of 4
(2,507 Views)
Hello P.J. O'Rourke (tbd),
 
Sorry for the delay in replying. I am attaching my file Revised_Calculator.vi. Please let me know if you could help me out with my query.
 
Many Thanks,
Smiley Wink
Suhail.
0 Kudos
Message 3 of 4
(2,463 Views)
Hello Suhail,
 
I looked over your calculator vi and can see there are many issues.
 
1. Your while loop doesn't loop more than once because you have the "=" button wired to the "Run while True" terminator; you need to change the terminator to "Stop when True".
2. Your function button text, which is the button's "Label", "covers up" a lot of the button space, you have to click a corner of the button to operate it. Use the button "Caption" property to display the text, do not show the label.
3. You are trying to use the array search function to determine which function generated a non-zero result. The array search gives you the index into the array with your desired result, not the result itself. Even if you fix this, what happens if the result of the calculation is zero? It won't be found; even though the indicator will show zero, you may want a better way to determine which calculation was used.
4. Some of your calculations, like the trig functions, are made in both the True and False case check on the function button, these functions always generate a value and cause the array search to return the wrong index.
5. You may want to change the button mechanical actions to something like "latched when pressed" instead of "switch when pressed", then the vi will start with the buttons "off"; running this vi to test it requires you revert the buttons to default values before running again.
 
You could simplify this vi by using the event structure in the while loop to perform the selected calculation when one of the function buttons switches to True. You could update a shift register in the while loop with the value from the most recent calculation. There are several options here, I'm not sure what functionality you really need and want - do you need a separate display for every type of calculation? Waht do you really want displayed in the main indicator before the "=" key is pressed?
 
Good Luck - Brian
 
Message 4 of 4
(2,455 Views)