LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

event structure with ActiveX MoveComplete event

Hi,

 

I'm working with two thorlabs stepper motors and I want to sequence their moves so that motor B starts moving when motor A has finished moving. I'm using the ActiveX MG17Motor controllers which fire the MoveComplete event when a motor has finished a move. I was thinking about having a MoveAbsolute command for motor B inside an event structure, and make this event structure respond to the MoveComplete event from motor A. I know how to register the MoveComplete event but I haven't found out how to make the event structure recognize it. Do I have to get the callback VI to launch some notifier or perform some action? Is there some better way to sequence moves?

 

Any help would be really appreciated

0 Kudos
Message 1 of 5
(2,884 Views)

I usually work with ActiveX events the following way: - Create an indicator in the VI that contains your event structure and configure your event structure to respond on its "Value Change" event. - Pass the refnum of the indicator as user data to the callback VI and use the "Value (Sgnl)" property to write data to the indicator from inside the callback VI. Your idea to use a notifier seems also to be a good option but I never tried that.

0 Kudos
Message 2 of 5
(2,869 Views)

Thanks a lot for your help.

That sounds like a very good idea to me, it's actually exactly what I need, but I'm having some trouble in how to configure the callback VI to make it work with the change value property node. I don't know really how to wire things in there and how to link the refnum from the indicator. Could you explain it more clearly or attach some example please?

 

Thank you again

0 Kudos
Message 3 of 5
(2,854 Views)
Unfortunately I can't attach an example now but I try to explain a bit more in detail: - Create an indicator (I call it IND for clarification) in the same VI where your "Register Event Callback" node resides. - Configure an event case to respond on a "Value Change" of IND. - The ActiveX "Register Event Callback" node takes a user parameter. Create a reference to IND and wire it here. - Now you are ready to create your callback VI. Inside it you can find a control named "User Parameter". This is the reference to IND you previously wired in the caller VI. Use the "Value (Sgnl)" property to write a value to IND. "Value (Sgnl)" changes the value of IND and, most important, signals a "Value Change" event to wake your event hander up. If you need further help I'll attach an example later.
0 Kudos
Message 4 of 5
(2,832 Views)

Here is a small example that uses ActiveX events. The ActiveX control AXEventsExample.ocx is taken from the ancient devzone example "Using ActiveX Events with LabVIEW and Custom Control":

 

http://sine.ni.com/devzone/cda/epd/p/id/3071

 

but it uses event callbacks instead.

 

0 Kudos
Message 5 of 5
(2,817 Views)