LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structure

Hi,
Currently I have LabVIEW code with multiple events acting on many different keys/switches pressed (value change). How do I combined all those events by one single key pressed.
Thanks
Dan
0 Kudos
Message 1 of 19
(4,339 Views)
What do you mean by "combine"? Do you have multiple event structures or one event structure with multiple event cases? Do you simply want to trigger a sequential execution of all event cases when a certain key is pressed?
 
If you want, please attach a simple example to make things more clear to us.
 
 
Message 2 of 19
(4,336 Views)

Yes, what I meant was I have one event structure with multiple event cases and I want to trigger a sequential execution of all event cases when a certain key is pressed. Sorry my question wasn't clear enough the first time. 

0 Kudos
Message 3 of 19
(4,310 Views)
Is there the possibility that each event case gets called individually as well as in the sequence you mention?

If not, I would just put a for loop in the one event case, and have a case structure in the for loop which contains all of the other event cases.

If so, you can programmatically fire each event at the conclusion of each event case.  See the "Programmatically Fire Events" shipping example.
Message 4 of 19
(4,301 Views)
I would suggest using a statemachine with events. There is an example of using the event structure with a statemachine and events. I would also look at using the producer consumer with events.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 5 of 19
(4,299 Views)


@dphan128 wrote:
Yes, what I meant was I have one event structure with multiple event cases and I want to trigger a sequential execution of all event cases when a certain key is pressed. Sorry my question wasn't clear enough the first time. 

OK, create one additional even for key press, containing a case structure that depends on the desired key. In it, line up signaling properties for each of the other events you want to trigger. This will queue up all desired events in the desired order (user the error cluster to determine ordering). (If you don't want to change the values for the trigger controls, read the current values from local variables before feeding them to the signaling properties. they'll strill trigger a value change event). 🙂

(Of course common sense should apply, so don't do any circular triggering that you cannot escape, e.g. event A triggers B, which triggers C, which triggers A, ... ad infinitum.)

Message 6 of 19
(4,297 Views)

@dphan128 wrote:
Yes, what I meant was I have one event structure with multiple event cases and I want to trigger a sequential execution of all event cases when a certain key is pressed. Sorry my question wasn't clear enough the first time. 

OK, create one additional even for key press, containing a case structure that depends on the desired key. In it, line up signaling properties for each of the other events you want to trigger. This will queue up all desired events in the desired order (user the error cluster to determine ordering). (If you don't want to change the values for the trigger controls, read the current values from local variables before feeding them to the signaling properties. they'll strill trigger a value change event).

(Of course common sense should apply, so don't do any circular triggering that you cannot escape, e.g. event A triggers B, which triggers C, which triggers A, ... ad infinitum.)

 

Thank you much. I got it.

 

0 Kudos
Message 7 of 19
(4,269 Views)

Hi Altenbach,

I am not sure how to proceed with my code.  I'd like to pick an "Item Number", select the corresponding ID (from an array) for that Item Number and assign a "Value" to that Item Number and FINALLY spit out a string that contains the header, ID, Value and End Character -- all within 1 event structure and within the while loop (before I hit STOP).

I have got the first 2 parts ie pick an "Item Number", select the corresponding ID for that Item Number.  I am not able to do assign a value and then spit out the string.

I appreciate your response.

Thank you

KM

0 Kudos
Message 8 of 19
(4,220 Views)
Oops...I forgot to attach my code... here it is
0 Kudos
Message 9 of 19
(4,220 Views)
Well, the "value" and "item#" terminals belong inside the evet structure, wired directly to their respective index array functions. You currently use the "new value"event terminal, but what you get out depends on which terminal triggered the event. Too ambiguous. 😉
 
If I understand this right, the event should not fire until both controls are set. You could for example assign the event only to "values", so it only fires when the "value" gets set. Just select the item# always first, no need to fire an event for the item#, it will get read when the "value" triggers the event.
Message 10 of 19
(4,205 Views)