LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with a case structure

Solved!
Go to solution

I have the following problem:

I want that the structure from the TRUE case of the bigger case structure to start only when I switch from the button and activate the TRUE position. I observed with the probe tool that the structure is still executed in backgroun even if the bigger case is on FALSE. I want to make it start from the first position (the default case) of the inner case structure whenever I will switch from the button. I hope I made myself cleared. Thanks

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

Please don't maximize the diagram and front panel to the screen. That is very annoying on large monitors! Thanks.

 

No you did not make yourself clear.

 

If the outer case is false, the inner case structure in the true case will not execute. Most likely your troubleshooting techniques are flawed. Explain exactly what you are doing, what you observing, and what you expect to see instead.

 

Please convince us otherwise!

 

Is this running on a RT system? 

 

(General notes: You know that you can have multiple conditions per case. All you need is two cases for the inner case structure. If the number of iterations is known before the loop starts, you need a FOR loop, not a while loop, right? Don't use hidden controls (e.g. to define the wait), use diagram constants instead.)

 

 

Message 2 of 8
(2,644 Views)

Hi maryus,

 

your observation (or better assumption) is wrong.

As long as you set your button to FALSE the inner case structure in the TRUE case is not executed!

 

But: when you switch to TRUE case you wired the loop iterator to the inner case selector. So the inner case structure is not starting with it's first case but with the case corresponding to loop iteration count!

 

You can see all this by using execution highlighting!

 

Btw. when you have several cases in a case structure you can combine them to one case. It's all explained in the context help of the case structure! So you can combine cases (1, 3,4,6) and (2,5,7) into just one case each…

 

Edit: Damn, Christian was faster (with same conclusions)… 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 8
(2,638 Views)

You are both right, I would want to make my itieration from the inner TRUE case structure to always begin with the first case whenever I press the button, because I need that order to create a specific graph.

I think you both understood, but I will still attach some photos.

Download All
0 Kudos
Message 4 of 8
(2,611 Views)

The you should keep your own incrementer in a shift register. Initialize it with zero and increment it in the true case of the outer case structure (Wire it across the false case).

0 Kudos
Message 5 of 8
(2,591 Views)
Solution
Accepted by topic author maryus66

Here's what I had in mind.

Message 6 of 8
(2,587 Views)

Why would switch when pressed be the correct mechanical action?

 

I am tired and need sleep.  go get em! g`night!


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 8
(2,561 Views)

Thank you very much, you've saved me! Have a beautiful weekend!

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