LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Beginner dynamice event help

I'm just learning about dynamic events.  Can someone explain 2 things to me...

 

1)  When I wire a reference from a numeric control to the "Register for Events" node, I can select value change as the event.  When I reference a numeric custom control (.ctl), why don't I have the option for value change?  Does it have something to do with the type specifier for vi refnum input on the open vi refnum vi?

 

2) Could you look at the attachment.  Why does the loop only iterate twice if the dynamic events shift register is not rewired to the front of the "Register for Events" node?

 

Thanks as always,

Greg

v7.1
0 Kudos
Message 1 of 5
(2,989 Views)

gstanczak wrote:

I'm just learning about dynamic events.  Can someone explain 2 things to me...

 

1)  When I wire a reference from a numeric control to the "Register for Events" node, I can select value change as the event.  When I reference a numeric custom control (.ctl), why don't I have the option for value change?  Does it have something to do with the type specifier for vi refnum input on the open vi refnum vi?

 

2) Could you look at the attachment.  Why does the loop only iterate twice if the dynamic events shift register is not rewired to the front of the "Register for Events" node?

 

Thanks as always,

Greg


To answer your first question you will only get the value change event for controls and indicators. Wiring in a typedef, I assume you were using a constant, will not have anything associated with it that can change its value.

 

As for your attachment I am not sure why it is working differently however there are some other issues with your code. I don't think you want to register for your event every loop iteration. You only need to register it once. Generally you would have an event case to handle your stop button getting pressed. As written you will not stop the loop until you actually get a value change. In reality I believe you will need to get two value changes before your loop will actually stop. You will read the value of the Stop button immediately as you enter a loop iteration. When you do get an event you will leave the event structure and loop back around since the you would not have detected the Stop button was pressed while you were waiting for the event. Your next iteration you will see that the stop button has been pressed but you will need to wait for the value change event before you will be able to actually exit the loop. This error in logic will be the case regardless of how you register for events. To operate correctly you should have an event to detect when the stop button changes value.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 5
(2,975 Views)

I appreciate the reply.  Ultimately, I have a numeric control in a subpanel vi, and I would like to capture its change value event in the main vi.  In the main vi, I have 5 buttons, each of which mouse up events are handled by an event structure.  I would like to add a sixth case in the event structure, and have it handle a change value event in the numeric control in the subpanel vi

 

Thanks

 

v7.1
0 Kudos
Message 3 of 5
(2,957 Views)
Here is an example of what I believe that you are looking for.
Tim
GHSP
Message 4 of 5
(2,943 Views)

gstanczak wrote:

I'm just learning about dynamic events.  ...

 

 

2) Could you look at the attachment.  Why does the loop only iterate twice if the dynamic events shift register is not rewired to the front of the "Register for Events" node?

 

Thanks as always,

Greg


 

I can only assume that you have used the default option of "Lock FP..." when you register for those eventS. Yes events plural!

 

 

First time through you register for a change event and the event structure handles that event.

 

Second time thru you are creating an NEW event (prove it to yourself! Use type cast to cast the event ref to a a U32 and display it in an indicator) that is passed to the event structure so it handles the second event

BUT

 

1) your first event is still registered

2) It was registered to lock the FP

3) There is no event structure to handle that event!

 

Please review this Nugget written by Ton where he teaches us about Dynamic Event Registration.

 

Ben

Message Edited by Ben on 10-09-2009 08:09 AM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 5
(2,932 Views)