LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate event by timeout

Solved!
Go to solution

Hi all,

I have an event structure, whose events are all "value change"s of buttons placed on the front panel (each of them toggles a light when clicked).

I need one of the events to be executed also in case a certain time elapses (in order to allow one of the lights to blink).

Is there a way to generate such an event?

 

I tought about creating a timed loop running in parallel, which generates a "fake" event at every iteration... but how can this fake event be generated? (it looks like all events that can be handled by an event structure are generated by human action, like pushing buttons, dragging mouse etc.)

 

Many thanks, regards

Message Edited by xdaf on 09-03-2009 06:01 PM
0 Kudos
Message 1 of 8
(4,489 Views)

Using your already existing event structure, create a 'timeout' case.

If none of the other events occur before the specified time, the timeout case will run.

Just place the generated event within the timeout case.

Cory K
0 Kudos
Message 2 of 8
(4,484 Views)

Thanks for replying.

The default timeout event is already in use (for a different function), and have a different period.

 

0 Kudos
Message 3 of 8
(4,482 Views)

Create a timeout event and place in a property node for button you wish to "fake"

 

Value (Signaling)

 

That will cause to event for the button to fire running it's code.

 

Omar

 

 

Omar
Message 4 of 8
(4,480 Views)

Isn't there a timeout event built into the event structure? The default value is "-1", meaning it never times out, but you can wire a different value to the hour glass icon in the upper right corner. Then put your blinking light indicator inside the timeout event case and change its state on each iteration. Hope this helps!

 

Zador

0 Kudos
Message 5 of 8
(4,470 Views)

but how can this fake event be generated? (it looks like all events that can be handled by an event structure are generated by human action, like pushing buttons, dragging mouse etc.)

 

Try

 

Value (Signaling) Property

Short Name: Val(Sgnl)

Installed With: Base Package

Class: Control Properties

Sets the value of the control and generates a Value Change event.

This property updates the value of an object similar to the Value property. However, Value (Signaling) also causes LabVIEW to generate an event as if the user had interactively changed the value of the object. National Instruments recommends you use this property only when you rely on LabVIEW generating an event in response to the programmatic value change.

If this is a Boolean value configured with a latching mechanical action, this property always returns an error. Due to race conditions that can occur when you have a Boolean value with latching mechanical action, you cannot programmatically read Boolean values that are set with a latching mechanical action.

Omar
0 Kudos
Message 6 of 8
(4,466 Views)

Often a better approach is to move the "task" to be performed after an "event" occurs outside the event structure, typically in a parallel loop.  The event structure and anything else (such as the timeout) which wants to perform the "task" then sends a command to the task code via a queue.  By separating the tasks from the conditions which call them, no complicated fake events are required.

 

For an example of how this can be done, look at the Produce/Consumer (Events) Design Pattern.

 

Lynn 

Message 7 of 8
(4,460 Views)
Solution
Accepted by topic author xdaf

It worked, but I had to use a parallel loop as suggested by johnsold.

 

Thanks to all!

 

 

0 Kudos
Message 8 of 8
(4,451 Views)