From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview starter help

Guys I just started using Labview, I'm working on a tutorial that has 2 parts:

 

part 1: make 2 input controls( variable 1 and 2) and give them 4 operations (addition, subtraction, multiplication, and division) and a stop button

 

par 2: put all these in a while loop so that the execution stops when the stop button is pressed or if the variable 2 is 0, as division by 0 makes no sense. The hint given was to use the "equal to 0?" and "OR" functions

 

So I have worked out part 1 completely, and on part 2 I made a while loop and linked the "stop" button to the loop end function to stop the executions when the stop button is pressed. But I'm not sure how to work out how to stop the loop if variable 2 is 0, I literally started using LabVIEW for the first time, so any help will be greatly appreciated. 

Download All
0 Kudos
Message 1 of 6
(2,375 Views)

Hi elliot,

 

The hint given was to use the … "OR" functions

I'm not sure how to work out how to stop the loop if variable 2 is 0

So you already got that hint and you still aren't able to use the hinted OR function?

 

the execution stops when the stop button is pressed or if the variable 2 is 0,

The while loop stops when that "stop" button is true OR when var2==0.

Sometimes the solution is (not really) hidden in the question…

 

Maybe you should read about basic boolean operations in the Wikipedia first?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(2,357 Views)

I understand the concept of if V2==0 then stop or (work out the 4 operations and continue the loop), but I just don't know how to incorporate them into LabVIEW, can you please look into the image or the LV file I attached and suggest me on how to proceed 

0 Kudos
Message 3 of 6
(2,352 Views)

Hi Elliot,

 

I just don't know how to incorporate them into LabVIEW,

Use an OR function as was hinted to you!

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(2,324 Views)

You are so close.  First, let's clean up your diagram some.  Line up your functions and do a vertical compression.  Then clean up your wires.  A messy diagram is evidence of a messy mind.  Then let's add a wait in there so that you are not using 100% of a CPU core to do really nothing.  Now we can use the OR function with the stop button and the output of the Equal To Zero function as inputs and the output going to the loop conditional terminal.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 6
(2,308 Views)

As you posed the problem, the "Exit if Variable 2 = 0" condition really doesn't quite make logical sense.  You have 4 arithmetic operations -- for three of these (+, -, x), having 0 as the second operand makes (mathematical) sense, nothing "illegal" (nor immoral, nor fattening) there.  Two of them, namely + and x, even give the same results if 0 is the first variable.  The exception, of course, is division, which should give an error, so it makes sense to "trap" this condition and "do something sensible" (which might include stopping, but might also include popping up a message saying "Cannot divide by 0, I'm ignoring this request, try again ...").

 

I realize that you are doing a Tutorial Problem, and learning how to use LabVIEW Logic.  But at some point, you will (I hope) start formulating your own programs and tasks, so it isn't too soon to start thinking about Good Design, where an Action (Stopping, in this case) has a logical cause and "exceptions" are also logically handled.

 

Bob Schor

0 Kudos
Message 6 of 6
(2,294 Views)