LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case structure not working as expected

Solved!
Go to solution

Greetings All

 

I have a case structure that doesn't seem to be working it stays on in the on state.

 

I created the 1st circuit in 1st red block and it works each led blinks then turns off in sequence but when I try that logic in a case statement ( in the 2nd red block) they all stay on.  Is this the way the case statement suppose to work?  Is their a workaround?

 

thanks

 

0 Kudos
Message 1 of 4
(3,225 Views)
Solution
Accepted by sal22

First, you have a block diagram there.  A "circuit" is what you create in hardware with electrical wires and electronic components.

 

All of your case structures are all working as expected.  What you did at the top is different than the bottom.  In the bottom, each LED is located inside a particular case.  That particular case only executes when something is true.  You have no way of writing a False to the LED because if the LED is going to be false, that particular case won't execute.  Up top, the LED's are always in the execution path, so they get a True or False written to them as the case may be.

Message 2 of 4
(3,216 Views)

It's not clear what exactly you're expecting, but let's look at your logic:

 

BOOL1 = ON switch -OR-  (i > 6)

 

    If SOME NUMBER = 1, or not otherwise declared (we can't see the other CASE)

THEN

    NUM2 = BOOL1? SOME NUMBER : 0

    BOOL2 = NUM2 == 1

    RED LED 2 = BOOL1 -AND- BOOL2

ELSE

    RED LED 2 = Unchanged

 

That is some convoluted logic, BTW.

 

You do know that you're only changing the RED LED2 in the "1,Default" case. If the number is something else, the LED is left as it is.

 

 There's no way to judge what's wrong without knowing what it is you're trying to do.

Be aware that only ONE of the cases executes when a case structure executes. 

Message Edited by CoastalMaineBird on 08-19-2009 11:00 PM
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 4
(3,213 Views)

This is one of the best explanations i have seen to any problem here. Hats of to you sir, you have cleared up a different problem i have :).
Much appreciated 

Just a harmless student
0 Kudos
Message 4 of 4
(2,747 Views)