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.
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?
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
I just don't know how to incorporate them into LabVIEW,
Use an OR function as was hinted to you!
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.
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.