02-23-2018 01:19 AM
Hi
I have three Zaber T-LSR series motors that I want to control using LabVIEW. The three motors are connected to each other and are then connected to the computer with a single COM port. With this COM port I can select "device 0" to control all motors simultaneously or I can select device 1-3 to control them individually.
I want to move each motor independently, but at the same time, and while they're moving I want to read the encoder value. I have looked at all the example LabVIEW code provided by Zaber, but I cannot figure out how to do what I want to do.
I would really appreciate your help!
Solved! Go to Solution.
02-23-2018 01:43 AM - edited 02-23-2018 01:43 AM
Hi Peter,
what about using a loop to handle motor 1 to 3 one after the other?
I don't think there is a different option:
- all your motors use the same COM port aka "shared resource"
- you can either send the same command to all of them (device0) or separate commands to each (device1-device3)
(Well: one option could be to use separate COM ports for each motor to be able to handle them in parallel…)
02-23-2018 09:35 AM
Hi peterlabuschagne,
The ZaberTSeries driver includes 4 main subVIs: Write, Read, Blocking Read, and Request. The Write subVI sends a command. The Read subVI checks if there is a response at the port and returns it if so. Blocking Read loops the Read subVI until there is response on the COM port, and Request combines Write and Blocking Read.
When you send a movement command, a response will come once the movement has completed. This means that you can not use the Request VI, because you don't want to hold the program while the device is moving. Instead, use the Write VI to send each of the three movements. The devices will begin moving, and you can continue to communicate with them.
To read the positions, I recommend sending Request VIs with the Return Current Position command and Device 0 in a While loop. There is in a field in the Request VI input cluster for how many responses you want to read. Use 3 for this to read 3 responses to each Request.
The Responses Out pin from the Request VI will include the three responses in an array of clusters. Each cluster will include the device number that sent the response, the command number that prompted the response (20 or 21 for a move, 60 for return current position ), and the data value of the response (the position if the command number field is 60). Check if any of the command number fields are not 60, and if so add to a counter. End the loop when the counter is 3.
Let me know if this doesn't make sense, or doesn't match what you're trying to do. If you're not sure, I would be happy to put together a quick sample VI.
You can also email me directly at mike@zaber.com.
Best Regards,
Mike McDonald
Zaber Customer Service
03-02-2018 01:14 PM
Attached is an example program that uses the method I recommended.