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 LabVIEW question regarding carrying boolean signal out of case structure

Solved!
Go to solution

Hello,

 

In my current program, I am trying to carry a boolean signal (Time Elapsed) out of a case structure to stop a while loop.

 

http://zone.ni.com/images/reference/en-XX/help/371361E-01/loc_bd_casestatus.gif

 

The while loop on the left is basically what I want to do yet whenever I do this, I get a green tunnel box with a white center.  It will not allow me to run the program saying that there is a missing assignment to tunnel.  What can I do to get around this?

0 Kudos
Message 1 of 8
(2,912 Views)

Hi booxcar,

 

Nothing looks wrong with the image you've attached but if you check your code, make sure that there aren't any empty case structures hanging around. With the image you attached all booleans leaving the case structure are connected. Granted, if you haven't fixed it already, you'll need to change the constant to false after Test 2 runs otherwise your while loop will never finish executing.

 

Feel free to attached the code if you're still having problems.

 

-Tim



Tim Sileo
RF Applications Engineer
National Instruments



You don’t stop running because you get old. You get old because you stop running. -Jack Kirk, From "Born to Run" by Christopher McDougall.
0 Kudos
Message 2 of 8
(2,903 Views)

The image that I have shown is a picture of what I am trying to do and not a picture of my actual code.  My code is more or less the same in terms of structure except the tunnel is white in the middle.

0 Kudos
Message 3 of 8
(2,900 Views)

Your question is extremely basic. Have you done any of the LabVIEW tutorials, or looked at the Help file? A tunnel is the mechanism for passing data to the next node. All case items must generate data. Either provide the data, or right-click on the tunnel and select "Use default if unwired". For Booleans the default is true.

 

Please do the LabVIEW tutorials and read the Help file.

 

To learn more about LabVIEW it is recommended that you go through the introduction material, tutorial(s), and other material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. There are also several Technical Resources. You can also take the online courses for free.

0 Kudos
Message 4 of 8
(2,897 Views)
Solution
Accepted by topic author booxcar

The white centre means that there are some of the cases in which you do not have a boolean wired to the output tunnel. The value of the output tunnel is the value that is wired to in in the case that executes, so a value must be available in every case.

 

There are two possible solutions.

1) [Normally preferred] Wire a boolean to the output tunnel in every case. The output tunnel will then go to a solid colour.

2) Right click on the tunnel and select "Use default if unwired" You will notice that the white centre will get smaller. This is like wiring a false constant to each of the cases that currently have no wire. The disadvantage here is that this can obscure logic errors. You might have intended to wire something there but didn't, and no syntax error was flagged.

 

Rod.

 

0 Kudos
Message 5 of 8
(2,894 Views)

Attached is a picture of an example code of what I am trying to do and the problem that I am presented with.  In my actual program, the boolean control is in the form of an Elapsed Time..  What am I exactly doing wrong?

0 Kudos
Message 6 of 8
(2,881 Views)

Ah, got it. Well then I definitely would recommend rifling through all the cases and checking to see that there are no empty ones. Easier than that is right-clicking on the case structure and selecting "Remove Empty Cases".

 

You can use the "Use Default if Unwired" option but like was mentioned this can cause unwanted errors and with booleans it's always better to wire a constant to every case. In your case, if you are using the "continue while true" option on your while loop then using the default if unwired option would cause the while loop to stop since the default value is actually false with booleans (Unless the default value option is smart enough to know that it is connected to a continue while true conditional terminal...someone please correct me if I'm wrong). You can verify that the default value is false (normally) with this code below. Case 0 has the defualt if unwired set and case 1 writes true.

 

DefaultUnwiredTest.png



Tim Sileo
RF Applications Engineer
National Instruments



You don’t stop running because you get old. You get old because you stop running. -Jack Kirk, From "Born to Run" by Christopher McDougall.
0 Kudos
Message 7 of 8
(2,879 Views)

Oh, nevermind, I understand what you mean by having to wire to all cases... Just flew over my head for some reason.. Thanks for the help!

0 Kudos
Message 8 of 8
(2,878 Views)