09-14-2009 05:13 PM
Problem:
I want to move a certain distance on the x-axis (working fine), but I want to know when this completes so I know when to start AND stop data acquisition. I've been using method calls to repeatedly get the current position of the motor and making sure that falls within my bounds of travel, but it seems cludgy and overcomplicated. I did some searching and found that I can use something called "MoveComplete", which notifies me when the motor is done moving. I'm pretty new to labview and I'm clueless how to access this functionality. I figured it would be a method provided by a node, but it is not. I've been doing a lot of searching and reading and I'm guessing I need to set up an event (with handler, etc.)? I've looked at the event with excel example and I'm still lost. Again very clueless how to do this. Anyone who has some advice or a working example would be GREATLY appreciated. Thanks.
p.s.
I'm working with a Thorlabs TDC001 servo translation stage
Solved! Go to Solution.
09-14-2009 05:27 PM
09-14-2009 06:14 PM
09-15-2009 08:47 AM
09-15-2009 03:05 PM
09-15-2009 06:26 PM
Thanks for the replies everyone. I think I got it figured out, setting up the event and callback (see attached-1), but I'm questioning how I'm stopping my data acquisition loop. Currently in the callback vi I'm setting a global variable's boolean value to stop my loop (see attached-2), but I'm wondering if there is a better way?
The translation stage is the MTS50 by thorlabs (http://www.thorlabs.com/newgrouppage9.cfm?objectgroup_id=3002&pn=MTS50-z8)
09-16-2009 07:39 AM
You can also query the status register with a method created from the ActiveX control. The ActiveX control changes the register status among other values such as direction, limit switch hit and motor stop. I typically program a motor move in a loop and stay in the loop until the motor stop value returns to zero. I mask the register value and look for the change to take place. This way no other move (or method) takes place until this move is completed.
09-17-2009 01:45 AM
For help in using the event callbacks in LabView with Thorlabs APT software there is an example loctaed on the latest APT CD (v2.9.0) at the following location;
root:Support\Developer Support\LabView\Basic Examples\Projects\Motor\TL Motor MoveComplete.vi
Setting the correct serial number for a motor controller within this VI and running it shows a call back routine for the move complete event. Run the VI and press the "jog button" on the front panel Active-X Motor control. Each time a move completes a message is displayed.
Should you not have the latest CD it can be downloaded from the Thorlabs website.
http://www.thorlabs.de/software_pages/ViewSoftwarePage.cfm?Code=APT
09-17-2009 02:10 AM - edited 09-17-2009 02:12 AM
I think you can use the statusbits to detect if the stage is moving or not.
This is a picture of another Thorlabs stage, but the principle would be the same.
plStatusBits is a Byte that is converted into 8 bits. Each bit is a statusbit. Bit 4 determines if the stage is moving or not (True or False).
09-18-2009 03:36 PM
@ Mark,
Thanks for the reply, but I actually found that after I had already come to the solution after some digging around. I only had v2.8 not v2.9, and didn't come across the example.
@ Heinen,
That looks more like what I want to accomplish, as I don't really need a callback vi, just want to know when the motor stops. I didn't realize I could access reg bits through these active X controls and LabView.
Now I just need to figure out how to get my acquisition rate constant across my bounds of interest. I'm always randomly +/- 1 off. I guess the way that I'm checking my threshold distances isn't very accurate, thus sometimes collecting 200 acquistions from my DAQ and other times 201, etc.