LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

display initial, intermediate and final conditions in one indicator

Solved!
Go to solution

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.

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

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. 

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

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,

0 Kudos
Message 3 of 8
(2,529 Views)
Solution
Accepted by topic author Thys

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 8
(2,528 Views)
Solution
Accepted by topic author Thys

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.

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

Crossrulz may I check my understanding with you please.

 

  1. you force a timeout event by setting the timeout to zero
  2. when the timeout occurs it kinda "primes" the system
    1. it consumes a do-while iteration
    2. uses up the first counter which is zero
    3. set the timeout to -1 which means wait indefinitely in future
    4. dumps the initial state data from the left side to the right side of the event
    5. leaves the do-while counter at a value of 1 which is what the do-case is expecting to operate on (which is why you scratched the incrementor)
  3. when the button is pushed the case operates as anticipated
  4. finally when it taps out or encounters STOP, behaviour is as expected and the indicators report the final outcome since they are on the right of the event

Yes?

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

That all looks correct.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 8
(2,492 Views)

Thank you sir.  Appreciate the time.

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