LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Asking a user for input trouble

Hi,
 
Im writing something where I need the user to input the width and height of a certain object and then output the area. I will use that area for later calculations.
 
The problem I am having is its continuously running every time, I only want it to run if the fields are left blank or the area is equal to zero.

Any suggestions on what I should do? 
 
I am using labview 8.20
 
Thanks
-D
0 Kudos
Message 1 of 2
(2,467 Views)


@Darren870 wrote:
The problem I am having is its continuously running every time, I only want it to run if the fields are left blank or the area is equal to zero.

What kind of controls are you using for the inputs? Logical would be numeric controls (not e.g. strings).

Use an event structure inside a while loop, triggerend by a value change in the two inputs and recalculate the area whenever one of the inputs changes. (it is probably cheaper to always calculate the area, even if one or both of the inputs are zero. You will simply get an area of zero, which is a correct result.

A normal program never uses the "continuously run" button. If you want the program to stop after the area is no longer zero, do the above and wire the area result to the loop termination via a "not equal zero" node. Typically you would not do that, but instead keep it running as long as you need to calculate areas.

0 Kudos
Message 2 of 2
(2,449 Views)