LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically executing several events in an event structure sequentially

I have an application that runs various component characterization tests using an event structure. The event structure has one event for each test. I now need to automate the execution of a subset of the tests. How can I execute several events sequentially from one front panel button?
0 Kudos
Message 1 of 9
(3,254 Views)
Sounds like a good application for a "queued state machine". Search on that term to find examples.
~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 2 of 9
(3,248 Views)
You can use "user defined events". If you have events A and B which are now fired by a button you can create a user defined event Ub and fire that event in A. Edit the event structure for B to handle B and Ub events.

Read the chapter about Events Functions in Help and get a look a the examples under "New examples for LV 7.0 >> Registring events dynamically and Handling user events".
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Message 3 of 9
(3,242 Views)
I would use a statemachine. I would first build a subvi that runs the test using a statemachine then use the event structure to call the subvi with the push of a button. You alredy have the states setup in the event structure so all you have to do is copy the code into the state. Look into help for using state machines and different architecture. Doing it this way will also help you in the fact that you will be able to add more test or delete some test if desired, Your program will be more modular.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 4 of 9
(3,234 Views)
I assume you have a button for each test that triggers each test event.

With a new button and event, you can use the Property Value(Signaling) to trigger the other events in the order that you link them together within your new event. See attached.
Randall Pursley
Message 5 of 9
(3,222 Views)
Randall,
Thanks, this is exactly what I am looking for. I can use this to sequence my 15 tests in any order I want.
I didn't think it was possible to execute one event case while another was active. Tracing the program, I see that the three property nodes in event "EAB" execute before any of the three called events executes. It appears that execution of events E, A, and B are queued without explicitely doing so. It isn't obvious why this works. Also, why is the local variable for button EAB wired to the OldVal Event Data Node?

Bob
0 Kudos
Message 6 of 9
(3,208 Views)
As per the email you sent, the mechanical action of the when when set to "switched until released' causes the event to execute twice. To fix this, I set the mechanical action to 'switched when pressed' and then changed the value back to reset the button without triggering another event. Maybe if the even was changed to 'Mouse Down' or 'Mouse Up' the double execution wouldn't happen.

As for why it works, as you mentioned the events are queued. I found it out modifying an existing program that I didn't want to have to rewrite.
Randall Pursley
0 Kudos
Message 7 of 9
(3,188 Views)

I found this 19 years after you posted it. It's great, I was looking for a way to do this.

 

0 Kudos
Message 8 of 9
(86 Views)

@rpursley8 wrote:
As per the email you sent, the mechanical action of the when when set to "switched until released' causes the event to execute twice. To fix this, I set the mechanical action to 'switched when pressed' and then changed the value back to reset the button without triggering another event. Maybe if the even was changed to 'Mouse Down' or 'Mouse Up' the double execution wouldn't happen.

As for why it works, as you mentioned the events are queued. I found it out modifying an existing program that I didn't want to have to rewrite.

"Switched when released" is more appropriate.  This is how buttons usually work in Windows.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 9
(59 Views)