From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems when trying to move 3 stepper motors

Solved!
Go to solution

Hello,

 

I am having problems when I try to build a program to control 3 stepper motors.

 

I have 3 steeper motors and the controller (3 SMCP33 + SMCP33-EVA) from nanotec.com they provide also a Vi example to control one motor that works successfully but the problems come up when I try to adapt the program to try to run the 3 motors. The final application for that is going to be a Cartesian robot XYZ so eventually I will need to program coordinates to move the 3 motors.

 

I am new in LabVIEW so what I am doing is trying to adapt the nanotec example to control the 3 motors doing the following.

 

- I assign each motor a different address, doing that I can run each motor separately. But when I try to run 3 programs at the same time, they work but all of them move the same motor (the first that was run).

- If I try to do a kind of subVi the same thing happens, only one motor is driven.

- Furthermore,  I get back a warning when I try this, I enclose a screenshot of that.

 

I enclose the Vi and screeshots to enhance my description.

 

I woul be grateful if someona can aport some help.

 

Regards.

Download All
0 Kudos
Message 1 of 5
(2,417 Views)

How does the controller know which motor to run? I do not see anything in the Motor1 VI which looks like an address or motor selector.

 

Lynn

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

Hello johnsold,

 

Thank you for replying. Enclosed is a picture where can be seen the motor address. This case is for motor 1, for motor 2 would be number 2 and 3 for motor 3. It works if I run the programs one by one. Anyway I enclose the generic example without any manipulation by myself.

 

Thanks again.

Download All
0 Kudos
Message 3 of 5
(2,371 Views)
Solution
Accepted by topic author perez-fernandez

Thank you for posting the original.  Comparing the two VIs immediately gives a hint as to what may be happening.

 

In the image you posted you circled two places where you changed the Drive address. In the Nanotec-Example.vi the Drive address is connected to about 14 places.  So when you try to run the other motors in your modified program, the 12 places you did not change the Drive adress are still set for Motor 1.

 

What you should do is to split the example VI into at least three parts.  The first part does the initialization. The next part moves the motor.  The last part makes sure the motor is stopped and does any other shutdown required.  Each part becomse a separate subVI. Each subVI has the Drive address as an input.  The initialization and shutdown parts are placed before and after a while loop.  The move parts are inside the loop.  You can either use three of each subVI for the three motors or make a combined subVI with three move subVIs to handle all three motors.

 

I cannot say which approach might be better without knowing more about how you plan to control the motors - one at a time or all three simultaneously, what kind of feedback is used, how error handling will work, and other topics.

 

Lynn

0 Kudos
Message 4 of 5
(2,352 Views)

Thak you very much!

 

I have come back to the original example renaming it as 1, 2 , 3 and I have run the 3 VIs giving diferent address to each one and it works. Now I have to do something to control the 3 VIs by a single one folowing your advice.

 

Thanks again!

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