06-11-2012 08:58 AM
Hi,
I'm getting to grips with Dynamic events in LabVIEW. However, I've encountered an issue i'm not sure on. When I try to register a cluster of control refs to the Register for Events function I get an error.. See Dynamic Event Registration.vi for small vi highlighting the issue.
Thoughts?
Strokes
06-11-2012 09:17 AM
Hi,
You can't connect the control directly, but a reference of that control, then you will be able to select the type of event you want to catch.
To create a reference on your cluster, right clic on it and select "create" >> "reference"
Hope this helps
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
06-11-2012 09:25 AM - edited 06-11-2012 09:26 AM
You can wire a reference or an array of references to register for events. Of course you probably already know that you have to wire the output of register for events to the dynamic registration terminal of the event structure.
06-11-2012 10:35 AM
@Steve Chandler wrote:
You can wire a reference or an array of references to register for events. Of course you probably already know that you have to wire the output of register for events to the dynamic registration terminal of the event structure.
@Steve Chandler wrote:
You can wire a reference or an array of references to register for events. Of course you probably already know that you have to wire the output of register for events to the dynamic registration terminal of the event structure.
That helped me somewhat, however, I'm still experiencing problems. My events seem to be registering correctly but don't seem to generate when I trigger them. I've configured the event structure to execute should one of the controls in my cluster change value. However, the only event case that get's executed is the timeout case.
I've attached a vi highlighting my problem named Dynamic Event Problem.vi. My real vi is much larger and contains many sub vis so hopefully what I've attached suffices..
06-11-2012 10:39 AM
It is missing a subVI. Also the control is part of a library that is not attached. Can you zip the whole library and attach that?
06-11-2012 11:13 AM - edited 06-11-2012 11:17 AM
@Steve Chandler wrote:
It is missing a subVI. Also the control is part of a library that is not attached. Can you zip the whole library and attach that?
My bad... I did up the question in a rush before clocking off time. It'll be tomorrow before I get a chance to upload the missing vi.
Apologies,
Strokes
EDIT: Any ideas off the top of your head..? I'm fairly sure the events are registered correctly, the timeout case executes every when no event is detected on a loop iteration but required event i.e. control value change never fires? Maybe I should just wait for tomorrow... it's bugging me though..
06-11-2012 11:33 AM
06-11-2012 11:39 AM
I'm changing the values of the contents of the clusters by pressing booleans, changing menu rings etc. on the top level applications front panel. I've grouped all of the controls in a cluster for convenience and registered this cluster for value change events where I understand each element can fire the event should a value change...
06-12-2012 02:38 AM
@Steve Chandler wrote:
How are you changing the value? The event will only fire if a user actively changes the value of a control and not by programatically changing the value. If you want to do that you need to wire to the Val(Signalling) property.
I'm not really in the position to upload the entire library I think I've simulated my problem in the attached vi. I'm assuming that once the value of a control changes (e.g. boolean button goes from false to true) that the reference to this control changes also and hence an event sure fire if configured correctly. However, this doesn't seem to be the case.
I'd appreciate it if you could have a quick look.
Strokes
06-12-2012 04:58 AM
Try using an array of references instead of a cluster. See the attached example.
About your example:
Place the Register for Events node outside your While Loop. That way it only runs once without extra code.
There is rarely a reason to use a "Wait Until Next Multiple" function with an Event Structure.
steve