LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fire multiple event sequentially with one control

Hello
 
I have for example three event cases within my event structure code:
 
1.  Initialize
2.  Read
3.  Write
4. Stop ( to stop the program)
 
'Read" , 'Write'  and 'Stop' are tthree event cases that fire indedendently that I need to have.
 
'Initialize' is another event case where,  in addition to doing something else, I would like it to fire Events 'Read' and 'Write' sequentially( order independent) when I press, say a button control associated with this event (#1).
 
Is there a way to do this? An example would be of great help. I have searched the forum and found some discussions but not quite what I am trying to do.
 
Thanks in advance
 
klk
 
 
 
 
 
 
0 Kudos
Message 1 of 2
(2,433 Views)
One way to handle this would be to use a producer-consumer design that uses a queue to interact between the 2 loops. One loop has your event structure, where there is an event that handles each button press. The initialize button press enqueues all 4 states. The other buttons enqueue their respective states.
 
Your consumer loop dequeues an element and checks what the command is, then selects the correct case to execute. This architecture will handle what you want to do. Search the example finder for "producer consumer" as well as queues if you haven't used them before.
 
A much less elegant solution would be to use the value(signaling) property of read, write, and stop in the initialize event case. This will basically queue up the events internally and execute each. You will have to change the buttons to "switch when released" and use a local variable to set each back to false in it's respective event case. This will work, but it is rather quick and dirty.
Message 2 of 2
(2,426 Views)