LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Alternative to using event structure with producer consumer?

Solved!
Go to solution
I've used the producer/consumer architecture in the past to control a state machine with event structures.  I'm now working with the base version of LV which does not include the event structure.  Can anyone recommend alternatives on how to use the same architecture in this case?  Thanks,  David 

 

0 Kudos
Message 1 of 5
(3,393 Views)
Hi, David. Use Queues (not sure that base version supported this). Andrey.
Message 2 of 5
(3,391 Views)
Solution
Accepted by topic author David.D

Prior to the introduction of the event structure the only option was polling.  The control terminals are in a while loop (the producer) with shift registers and a wait, typically about 100 ms.  On each iteration of the loop the current value of the control is compared to the previous value.  If it has changed, then take the appropriate action.  As Andrey suggested, queues are a good way to pass the information between loops.

 

This works for the equivalent of Value Changed events.  Things like Mouse Up or filter events were not possible or much more difficult.

 

Lynn 

Message 3 of 5
(3,385 Views)

Thanks.  Not pretty.  

 

I'm surprised that event structures are not included in the base version of LV.  Seems like simple functionality to me.  I spent nearly half an hour scratching my head trying to remember how to handle events.  Regardless, I'm happy to have a solution. 

 

Thanks again,

 

David

 

 

 

0 Kudos
Message 4 of 5
(3,355 Views)

Additionally you should use the 'wait for front panel activity' VI, this will let the loop wait until the user has done anything on the FP (like an event structure), than you check for changes.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 5 of 5
(3,326 Views)