01-28-2015 04:04 PM
I have two indicators, one mimicing a multi-colour LED and the other a text string. I'm using an event loop inside a do-while to monitor for a button push that triggers a response.
At the start of the program, I want to set an initial condition for these two indicators eg LED off and string "Starting..."
As the program runs, the LED colour changes and the string updates according to some logic.
The program gets tired of running ie counts to 10 and decides to stop, setting the LED and the string to a time-out condition.
Alternatively, the user can hit the stop button, in which case the LED and the string show a stop condition.
Trouble is, if I put the indicators at the left registers, I get the correct initial condition but an incorrect final condition. If I put the indicators at the right registers, I get correct final but incorrect initial conditions. How do I get correct initial AND final conditions?
A slap in the right direction would be highly appreciated.
Solved! Go to Solution.
01-28-2015 04:14 PM
I cant open your VI because its to modern for my labview, but why do you not just start your while at a -1 rather then 0 position? That way when it updates the first round it should put the correct initial results into the outputs. The other option which should be considered cheating is to simply feed your LED and String from local variables before the loop to force update them to the initial conditions.
01-28-2015 04:50 PM
I think you should put your LED terminal on the right to have a correct final condition.
You can initialize your LED before the While loop, using a local variable perhaps?
Cheers,
01-28-2015 04:52 PM
Use the timeout. Using a shift register, you can set the timeout of the event structure to be 0 for the first iteration and -1 for all other iterations. So then you can update your indicators on the right. In the timeout case, you just wire your statuses straight through.
01-28-2015 05:36 PM - edited 01-28-2015 05:42 PM
Thanks for the ideas OGK and Jimmy. I love elegant solutions so cheating isn't an option LoL
Crossrulz SMOKED IT!!! Thanks -- that's a big step forward in understanding LV.
01-28-2015 06:06 PM
Crossrulz may I check my understanding with you please.
Yes?
01-28-2015 06:22 PM
That all looks correct.
01-28-2015 07:36 PM
Thank you sir. Appreciate the time.