11-18-2009 10:35 AM
I have written a VI that is an event driven state machine. The events are operator actions taking place on latched buttons on the Front Panel. Each event puts one or more state names on the state queue. A state machine then takes the state names off the state queue and uses them to open the appropriate cases which contain the functions to be performed....Now comes the desire to interact with this vi programatically from another vi. Since the the events can't be caused remotely because the buttons are latch type and can't be manipulated by property node (value(signal))...Is there some way to remotely add a state name to the state que...? That would be neat.
I would rather not add any "hidden" buttons to the original vi, or have to modify the event structure.
Is there a better way...?
Hummer1
Solved! Go to Solution.
11-18-2009 10:40 AM
Either you use "Obtain Queue" with the same name in the other VI or you use a Functional Global Variable to pass the Queues Reference to the other VI.
Then you write the state names via "Enqueue Element" as you would do it in the VI containing the State Machine.
11-18-2009 10:44 AM
I like Christian's suggestion but as far as the latch action preventing the use of value-signaling...
Change the latch action and just write a false to a LOCAL of the boolean in the event case assigned for the boolean.
Ben
11-18-2009 10:47 AM
So, In the controlling vi, I could obtain Queue (with the same name as the Queue) in the controlled vi, and any items placed on the queue in the controlling vi would pass to the controlled vi...no further connections required?
Hummer1
11-18-2009 10:50 AM
@Hummer1 Exactly, do you see this connector called "create if not found?" at the Obtain Queue.vi, it says if you try to create a Q with the same name it refers to the allready existing one.
@Ben Thanks!
11-18-2009 10:50 AM
Yes!
Disclaimer:
The two VIs must be running in the same process context
Translation:They both must be started from the same project or both opened without a project.
If the two VI are opened from different projects LV will create a sepearte execution environment for both and they will not be able to to interact with the saem queue.
Ben
11-18-2009 10:54 AM
Thanks,
this is very powerful...and the context warning from Ben is very important too.
Hummer1