How to write an arbitrary indexing program for stepping motor
Many people think that the stepper motor can't be accurately indexed, and the driving method of the servo motor is too deified. As far as I am concerned with the experience of using a stepping motor as an indexing plate, in fact, you only need to know how to use a stepping motor and know how to write the program. The indexing accuracy under normal conditions can still be guaranteed.
No matter where the stepper motor is applied, one must ensure that there is enough torque. The stepper motor is a big horse-drawn car.
The startup time under normal conditions should generally be as long as possible. The speed of starting can't be too fast. Excessive start and stop may cause overshoot. In the process of use, if the indexing is incomplete, that is, it is normal to take a circle, but find out how to make a little bit worse, that is, there is a seam, this situation is the legendary out of step. The solution to the loss of synchronization is nothing more than the following:
Increase the motor torque and increase the current of the drive;
Reduce the maximum speed of operation;
Extended start time;
Reduce the starting speed.
If there is no problem with the above, then there may be a cumulative error in the program with a residual pulse that cannot be divided.
As we all know, the pulse is calculated as an integer, and there is no such thing as a half pulse. But often this half of the pulse has a problem. If a circle is divided into 10 equal parts, each aliquot of half a pulse is not a problem. 20 aliquots, half a pulse per aliquot may not be particularly noticeable. However, when it is divided into 50, 100, 500, nnn aliquots, such a halving pulse may not be a small number. The more aliquots, even if each aliquot is 0.1 pulses, is an astronomical number. This is why many people think that stepper motors can't make precise indexing discs. This is not just a progressive motor, even a servo motor, this problem also exists - the remainder.
As follows: the number of subdivisions of the stepper driver is 64. Then the number of pulses per motor is 62x200=12800.
Now set the motor to 128 equal parts, then calculate 12800/128=100 well. The number of pulses per aliquot is 100 pulses.
But if I now ask to divide into 129 equal parts, the formula is: 12800/129=99.2248062, that is, each aliquot requires 99.2248062 pulses to be evenly divided, so the count is removed from the decimal point remainder, then the total error of 129 eq is 129X0 .2248062=28.9999999 pulses. Equivalent to this circle is an error of 1/4 of an aliquot.
Due to my limited cultural level, I have spent a considerable amount of time thinking about it and finally solved the processing method of this residual pulse number.
Taking the example of the surface as a reference, the number of motor pulses is 12,800, which is divided into 129 equal parts. The maximum error required to complete a lap is no more than 1 pulse.
The programming method is as follows:
Set the number of motor pulses, this is dead, you can not write. 12800 or other values.
Set the number of equal parts to be divided: 129 into the data register D or V
Calculate the number of integer pulses required for each aliquot: 12800/129=99
Accurately calculate the number of pulses required for each aliquot. The result of the floating point operation is: 12800/129=99.2248062
Turn 99 into a floating point number and get the data as 99.0
Then, using the calculation formula of 99.2248062-99.0=0.2248062, the number of pulses per aliquot is obtained.
Multiply the total number of pulses by the remaining number of pulses: 0.2248062x129=28.99999998. Remove the decimal point to get the integer 28.
Subtract 28 from the aliquot to get: 129-28=101. This data is the number of aliquots in the process.
The program runs to: The aliquot that has been added is greater than 101, that is, from 102 equal parts to 129 aliquots, in each of the 28 equal parts, one pulse is added for each aliquot. That is, the number of pulses starting from 102 equal parts is 99+1=100.
As calculated above, in the last 28 aliquots, each aliquot adds a pulse, which is an increase of 1/100 per aliquot.
Summary: From the above calculations, if the processing is not absolutely precise, the products processed by this program are fully satisfactory.






