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: 

Simple calculator divide by zero help

Solved!
Go to solution

Hello, I'm trying to make a simple calculator with the four basic operations. I want to an LED to turn on when I am dividing by zero. However, if I divide by zero, the LED turns on, and then when I switch to a different operation, the LED remains on until I switch back to "divide" and make the denominator not zero. Can anyone help me with this issue? Thank you. Attached is my VI file.

0 Kudos
Message 1 of 6
(5,173 Views)

I assume this is a subVI to be used in a larger VI?

 

Move your divide by 0 indicator OUT of the case structure that way it gets updated no matter which operation is performed.

0 Kudos
Message 2 of 6
(5,149 Views)

No, I'm pretty new to labview and this is a simple first project. The thing is, I only want it to light up when dividing, so if i move it out of the case structure of divide it'll light up every time that my "denominator" is zero, regardless of the operation, correct?

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

No.  Not if you wire a False constant going out to in in every other case.

0 Kudos
Message 4 of 6
(5,126 Views)
Solution
Accepted by topic author ben822s

@RavensFan wrote:

No.  Not if you wire a False constant going out to in in every other case.


... or only wire it out from the divide case and set the output tunnel to "user default if unwired". It will only light up if the divide operation executes AND the divisor is zero. If will be false (unlit) in all other conditions.

0 Kudos
Message 5 of 6
(5,097 Views)

wow, thank you so much altenbach! this is only my first day using labview and this was extremely helpful! I appreciate it, thanks again!

0 Kudos
Message 6 of 6
(5,086 Views)