Showing results for 
Search instead for 
Did you mean: 

Controlling stepper motor using LabWindows/CVI

Controlling stepper motor using LabWindows/CVI

Hi, I'm not sure whether this is the right place for asking this question or not and if not, then please guide me to the right place for asking such question. Thanks.

I have a stepper motor with the Vector Network Analyzer Anritsu MS4623B. I got it up and running with the LabWindows/CVI. I need to sync the motion of the stepper motor with my data acquisition. Basically, I have to acquire the data in a way that in the start the motor will come back to home position wherever it was and then I want to move it to the specific position to do the measurements (For Example, I want to measure the 40 GHz channel between 1m to 3m movement of a stepper motor on a linear positioning system (ball-screw)). I've interfaced the VNA with the PC using LabWindows/CVI and I've controlled the clockwise and anti-clockwise movements of the stepper motor using LabWindows/CVI but I'm unable to sync the system in a way that whenever I run the code, the motor will run back to the home position and then move to a specific measurement start position and move till the end position and in between do the increment and stop and acquire the data. Is there any one to help me please? It's really urgent please and I'm doing this thing first time so please guide me in a proper way. I shall really apprecaite that and will be highly obliged with you. Thanks for your time and concern.


Thanks and Regards.


0 Kudos
Message 1 of 8

Re: Controlling stepper motor using LabWindows/CVI

Hi there! I see you posted on some other threads, but as this is its own unique question, it's probably best handled here on the new thread you made.


To start off, are you using NI-Motion? If not, how are you controlling your motor? I see you might be using serial commands to accomplish this, because you have some references to "RS232"/"COM" on your front panel under motion control. And are you using encoder feedback to know where your motor is?



Ravi A.
National Instruments | Applications Engineer
0 Kudos
Message 2 of 8

Re: Controlling stepper motor using LabWindows/CVI

Thanks for your reply Ravi, basically I'm using LabWindows/CVI COMWRITE commands to move the motor to clockwise and anticlockwise direction and for knowing the home position of the motor, there is basically a sensor switch or you can say the 'Limit Switch' which will sense automatically the home position of the motor on the ball-screw linear positioning system. In addition to this, I'm using the following manual to keep up my work which you can find in the attachment. Now what I really want to get help in is basically to automate this process that whenever, I'll run the LabWindows/CVI program, the motor will run to the home position and then it will move to the start position from where I want to take the measurements and after reaching the start position, it will increment automatically and acquire data and then move to the end position and after completing the measurements and acquiring data, it will move to the home position again or even if it will not move to the home position, it's fine, but in the start it must have to move to the home position. So, now can you please help me in this regard as I'm really feeling helpless at this end and I'm really worried. Smiley Sad

I shall be highly obliged with you Ravi and I'll really appreciate that if you would help me in this regard.

Thanks in advance.

Please see the manual in the attachment.

0 Kudos
Message 3 of 8

Re: Controlling stepper motor using LabWindows/CVI

Hi Community,


Just thought I'd post the solution that Ali and I found to his problem on here for completeness.


We found that the manual stated a command that will move the motor clockwise/anticlockwise for a certain number of steps OR until the limit switch is pressed. So all Ali has to do is to run this command, with the number of steps to move as the maximum and the motor won't stop until it presses the limit switch to indicate that it is in the home position.


I've included a screen shot of the manual with the two commands for moving the motor highlighted.


Kind regards,

James W
Controls Systems Engineer
0 Kudos
Message 4 of 8

Re: Controlling stepper motor using LabWindows/CVI

I'm working with a UMI 7774, PCI 3334, step motor and encoder. I'm using a NI motion assistant and MAX. I have to put this system in LabView. It's necessary create bottoms to start,stop, torn the left and right and control de velocity.


Could you send your project , please ?

0 Kudos
Message 5 of 8

Re: Controlling stepper motor using LabWindows/CVI

That project won't help you in any way: it's in LabWindows/CVI while you are using LABVIEW, it's serial and not NI motion and it seems also related to a different hardware! 

I suggest you to post a descriptive question to the appropriate board

Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
If I have helped you, why not giving me a kudos?
0 Kudos
Message 6 of 8

Re: Controlling stepper motor using LabWindows/CVI

I'm working on the same thing almost as ALITa motor with spectrum analyzer ZNB8 ROHDE & SCHWARZ and I'm stuck in the same points that ALIT, made the idea is to make measurements by turning the engine as a starting point and end and not that I chose is the non-continuous mode, but I just happen to run the motor in continuous mode (clockwise and anti_clockwise), have you solutions help pleaasee

here is my code I have tried but I do not have got what i want :


int CVICALLBACK RunMotor (int panel, int control, int event,
        void *callbackData, int eventData1, int eventData2)
 switch (event)



0 Kudos
Message 7 of 8

Re: Controlling stepper motor using LabWindows/CVI



Can't seem to find out how to write a new topic. I'm building a project that requires motion to be tracked from one location to another. I'm putting this system in a closed loop and I'd like some form of a feedback controller. Right now, I have stepper motors and I'm looking for a driver to get for this project. I'm looking for some direction and I'm hoping that you may help. Let's say I need to pick out the driver for the stepper motor, what should I be looking for? What type of sensors do I need to acquire the signals I need to figure out my positions?



0 Kudos
Message 8 of 8