LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Update different indicators after different times

Solved!
Go to solution

I have different elements on my front panel and would like to update them after different amounts of time have elapsed. (This example uses multiples of 250 because I'm not original, but assume arbitrary times.) 

 

KISS MethodKISS Method

 

Is there a better way to combine these three loops while maintaining timing independence and keeping an intuitive back panel?

0 Kudos
Message 1 of 11
(4,119 Views)

Once you also have other events, the use of an event structure for this purpose us not good, because any other event will reset the timeout. Also, your button belongs inside one of the stop events, else it will not reset.

In this case I would recommend a single loop running at 250ms (GCD), then you can do some simple math based in the iteration terminal to decide what the boolean value should be for each.

 

For an LED it does not matter how often it is updated with the same value, but if you write to e.g. a digital output, you can use case structures to only do so if a change occurs.

0 Kudos
Message 2 of 11
(4,111 Views)

Hi ATE,

 

it seems you want to set indicators at multiples of 250ms: set the timeout to 250ms and count the timeouts…

 

Or: Use a state machine - it's also KISS… (States like "do something1", "wait some time", "do something2", "wait some time")

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 11
(4,108 Views)

I would also look at using the Elapsed Time VI.  You can have a different one for each indicator and use a case structure to conditionally write to them.



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 11
(4,101 Views)
Solution
Accepted by ATE-EGNE

Here's a simple draft of what I had in mind.

 Ticker.png

 

 

As you can see it shows the same behavior (and even resets correctly when the program starts. (your code will show stale values until the first update).

 

Also note that arrays make everything simpler. No need for all these loose terminals cluttering the diagram. 😄

Message 5 of 11
(4,089 Views)

Thanks for the suggestion, I like the use of the NOR gate (wouldn't have thought of that)
Here's what I have implemented:

Multi Update with Event 2.png

 

Considering that I want my Stop button inside the event producer loop, is there a better way than a dedicated event structure to end the ticker loop?

0 Kudos
Message 6 of 11
(4,046 Views)

@ATE-EGNE wrote:

Considering that I want my Stop button inside the event producer loop, is there a better way than a dedicated event structure to end the ticker loop?


Why would you need the stop button terminal in the producer loop?? All you need is the stop event . Since the button is latch action, a value change is necessarily a TRUE (very few exceptions*), so you can simply wire the "new val" event data node (or even a TRUE constant!) to the stop condition from inside that event (... and also add code to shutdown the consumer via the queue, etc.). This allows you to place the stop terminal in the bottom loop, eliminating the event structure there.

 

*one exception would be if the default value of the latch action button is TRUE. In this case it would turn FALSE until it is read by the code and returns back to the default TRUE value.

Message 7 of 11
(4,040 Views)

ATE-EGNE wrote:

Here's what I have implemented:


It does not work correctly because you have connected to the lower "IQ" output instead of the upper "R" output of Q&R. Be careful there! 😮 (compare with my VI above)

Message 8 of 11
(4,022 Views)

@ATE-EGNE wrote:

I like the use of the NOR gate (wouldn't have thought of that)


It is actually an XOR (exclusive OR).  A XOR TRUE = NOT(A)



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 9 of 11
(4,005 Views)

Yes, I am using an XOR (you could also just use a "not equal" :)). You replaced it with a "not XOR" for some unknown reason. Notice the little circle on the output of yours!

Message 10 of 11
(4,001 Views)