02-23-2010 10:34 AM
I have written a little queued state machine example to try to teach myself about creating and using user events. The objective of the machine is to periodically choose a number (I'm doing it now with a control instead of a random number generator for troubleshooting), and compare that number with the number I have set in a control. When they match, I want to cause an event to fire so I can do something about having found a match. The examples in the LV Help file references show the events within the event structure, but I want to reach out of a state and cause an event ....
Can someone point me in the right direction here?
Thanks
Hummer1
Solved! Go to Solution.
02-23-2010 10:37 AM
02-23-2010 11:48 AM
02-23-2010 12:51 PM
Yep....That was it...I had tried to do that but got fouled up with the variant definition...so defined the user event using a boolian and did the same in the case structure where I wanted to create the event and it worked great...
Thanks.
Here is the final version...not bulletproof, but does have a queued state machine using a user event to cause an event to fire.
Hope you find it useful.
Hummer1
02-23-2010 12:57 PM - edited 02-23-2010 01:00 PM
One question: why are you using the Value (Signaling) property all over the place? You're not catching those value change events in the event structure.
EDIT: also, I think you may still be partially misunderstanding user events. There's no need for the "Right Number Hit" button on the front panel. It's not tied in any way to the user event, you can use a constant instead as the input to Create User Event.
02-23-2010 01:00 PM
Yep...force of habit. value works fine...is that what you meant?
Thanks again.
Hummer1
02-23-2010 01:04 PM
I tried tying a T/F constant to the data type of the Create User Event and got an error...
Am I missing something?
Hummer1
02-23-2010 01:09 PM - edited 02-23-2010 01:09 PM
02-23-2010 01:10 PM
Updated for constant definition and name of user even within the variant...same for generating user event. Corrected the Val(signal) to value...
Example runs again.
Thanks...this is exactly what I needed to understand.
Hummer1