09-11-2006 05:53 AM - edited 09-11-2006 05:53 AM
Message Edited by marcoadf on 09-11-2006 06:04 AM
09-11-2006 06:03 AM
Good morning,
I cannot see your attached vi. Can you repost it? (In LV7.1 if possible)
I think I understand what you are trying to do. I'll try to prepare an example.
RayR
09-11-2006 06:09 AM
Sorry. Thanks.
09-11-2006 06:27 AM
09-11-2006 07:02 AM
Another approach is to use a Property Node inside the inner loop and read the Value.
I am curious. What is the False Case? Is it empty? If so, the only difference between the two would be the Query device & initialize Joystick,right?
Because, as soon as the boolean is False, the inner loop stops. In this case, in order to run, it has to be true because of the Case Statement.
Is this piece of code called from another higher-level vi?
I'll explain... It may be possible to simplify this vi by moving the switch to the inner loop, especially if you do not intend to use it to stop the outer one.
If you do not want the subvi (inside the inner loop) to run even once, then place a case statement inside the while loop which would contain the sub-vi and the indicator element. Doing so would provide similar functionality and cleaner code without having to use Local Variables or Property Nodes, thus being more efficient with memory.
And a bit more fun to implement... 😉
RayR
09-11-2006 09:05 AM
Thank you both for the help.
Aitortxo:
That's true, when it enter in the inner block it has true value, that's why I make the NOT, because the condition is "stop if true".
JoeLabView:
Yes, the only diference is because of the query and initialize, because it takes a lot of time, and I just need to make it one time. The loop is to read data frm joystick.
"It may be possible to simplify this vi by moving the switch to the inner loop, especially if you do not intend to use it to stop the outer one" Indeed, I use another button to the out loop (like a main loop mentioned). Should I put modify the "Comando manu" inside the inne loop? and this also works for the condition in the case statement?
09-11-2006 09:28 AM
Hello,
What I described is how to simplify the vi.
Actually, I would move the Query & initialize joystick completely outside the loops. Unless you want this to be done each time the outer loop executes..
There are many ways to implement a solution. The important part is to implement the solution in a way you expect it to run.
Have you done a state machine for this? Just to look at the logical flow?
RayR
09-11-2006 09:34 AM
Well, my idea was that it only execute the outsider loop one time(when I turn button true). Then it was always in the inner loop reading data. When I wanted him to stop, just turned button off.
I think taking the those block off the loops wiil be the best solution. The idea was that I could have the button off for a long time. When I plugged the joystick I would see if there was a joystick present. But you awared me to the outside loop. Is it running at the same timeas the inner loop?I mean, the outer loop will only repeat a loop when the case statement ends right?
09-11-2006 09:45 AM
From the sounds of it, it appears that you may not need the outer loop, unless, like you said, you want it to run and monitor when a device is plugged in.
That being said, you could keep the outer loop. Then simply mode the Commando Manu switch inside the inner loop and use it to stop the outer loop.
RayR
09-11-2006 10:03 AM