LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do i reliably control a stepper motor with non NI drivers?

Hello all,
I have a non-NI 96 line USB DIO board and several non-NI stepper motor drivers. I have been trying to program the motor control in labview, and have been successful to a point. The motor drivers run off ttl signals output from the usb controller and I have no problem with having labview get the signals out. My problem is this: once it try to set the motors to run faster than a certain speed, the motion becomes somewhat erratic and does the speed does not increase. I am running a sequence structure with a motor on pulse in sequence 1 and an off pulse in sequence 2 and then repeating the sequence in a while loop. The stepper motor is a 200 step/rev motor, and using the ms timer function in LabView, it seems to me that in a perfect world, I should be able to get the motor to spin at 2.5 rps (1ms on/1ms off = 2ms per step => 400ms/rev). Now I understand that there are going to be some slowdowns, but I am only able to get approx 0.5 rps, far below the ideal and too slow for my application. If i could get even 1.5 rps I would be happy. Can anyone give me any advice on how I might speed up the process.
Thanks,
JOe P
0 Kudos
Message 1 of 3
(2,566 Views)

It doesn't seem too surprising that you are getting rather slow rates.

  1. The calls to the dlls likely take some amount of time (let's say 3ms)
  2. Then the loop waits until the next ms multiple (Max of 1ms)
  3. Since you are not running this on a realtime system, then you will have inherent jitter in the loop due to other processes (say 2ms per run)

By adding all of these you see that each loop could easily take 3 + 1 + 3 + 1 + 2 = 10ms. So if you get a rate of only 100 Hz or 1/4 of a revolution per second then I would not be surprised.

The best thing you could do would be to get a DIO board that can handle pattern generation so that you aren't limiting yourself to simply make one call then another. You could also set up a counter to do pattern generation and then you know your output would be precise. You may want to check this device out: Low Cost USB Digital I/O Device.

0 Kudos
Message 2 of 3
(2,543 Views)
Hi!
Try this code generated by Kaustubh from India. I dont know how reliable it is but you will get 1 ms pulse to drive your stepper motor.

Jenilia D'souza
Canberra
Australia
Jenilia D'souza
0 Kudos
Message 3 of 3
(2,530 Views)