CN113258842A - Stepping motor control system and method based on pulse frequency conversion control - Google Patents

Stepping motor control system and method based on pulse frequency conversion control Download PDF

Info

Publication number
CN113258842A
CN113258842A CN202110533870.5A CN202110533870A CN113258842A CN 113258842 A CN113258842 A CN 113258842A CN 202110533870 A CN202110533870 A CN 202110533870A CN 113258842 A CN113258842 A CN 113258842A
Authority
CN
China
Prior art keywords
pulse
value
counter
new
frequency conversion
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110533870.5A
Other languages
Chinese (zh)
Other versions
CN113258842B (en
Inventor
胡建鹏
夏存宝
王良坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
HANGZHOU ZHONGKE MICROELECTRONICS CO Ltd
Original Assignee
HANGZHOU ZHONGKE MICROELECTRONICS CO Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by HANGZHOU ZHONGKE MICROELECTRONICS CO Ltd filed Critical HANGZHOU ZHONGKE MICROELECTRONICS CO Ltd
Priority to CN202110533870.5A priority Critical patent/CN113258842B/en
Publication of CN113258842A publication Critical patent/CN113258842A/en
Application granted granted Critical
Publication of CN113258842B publication Critical patent/CN113258842B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H02GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
    • H02PCONTROL OR REGULATION OF ELECTRIC MOTORS, ELECTRIC GENERATORS OR DYNAMO-ELECTRIC CONVERTERS; CONTROLLING TRANSFORMERS, REACTORS OR CHOKE COILS
    • H02P8/00Arrangements for controlling dynamo-electric motors of the kind having motors rotating step by step
    • H02P8/14Arrangements for controlling speed or speed and torque
    • H02P8/18Shaping of pulses, e.g. to reduce torque ripple
    • HELECTRICITY
    • H02GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
    • H02PCONTROL OR REGULATION OF ELECTRIC MOTORS, ELECTRIC GENERATORS OR DYNAMO-ELECTRIC CONVERTERS; CONTROLLING TRANSFORMERS, REACTORS OR CHOKE COILS
    • H02P8/00Arrangements for controlling dynamo-electric motors of the kind having motors rotating step by step
    • H02P8/36Protection against faults, e.g. against overheating, step-out; Indicating faults
    • HELECTRICITY
    • H02GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
    • H02PCONTROL OR REGULATION OF ELECTRIC MOTORS, ELECTRIC GENERATORS OR DYNAMO-ELECTRIC CONVERTERS; CONTROLLING TRANSFORMERS, REACTORS OR CHOKE COILS
    • H02P8/00Arrangements for controlling dynamo-electric motors of the kind having motors rotating step by step
    • H02P8/36Protection against faults, e.g. against overheating, step-out; Indicating faults
    • H02P8/38Protection against faults, e.g. against overheating, step-out; Indicating faults the fault being step-out

Abstract

The invention discloses a stepping motor control system and method based on pulse frequency conversion control. The problems that the subdivision mode of the existing stepping motor is determined, stepping is fixed, the running noise of the motor cannot be well reduced, and running jitter of the motor is reduced are solved. The system comprises an MCU controller, a step controller, a power amplifier and a step motor which are connected, wherein the step controller comprises a mode control module, a pulse frequency conversion module, a sin counter and a sin decoder. The mode control module outputs the frequency multiplication to the pulse frequency conversion module, and the pulse frequency conversion module carries out frequency conversion processing on the input pulse according to the frequency multiplication. The invention abandons the subdivision control of step values accumulated one time by one pulse, adopts the minimum step value and simultaneously carries out frequency conversion processing on the input pulse, so that the motor can be subdivided and operated with the highest hardware precision no matter in which subdivision mode, and the rotation of the stepping motor is more silent, stable and coherent.

Description

Stepping motor control system and method based on pulse frequency conversion control
Technical Field
The invention relates to the technical field of stepping motors, in particular to a stepping motor control system and method based on pulse frequency conversion control.
Background
At present, subdivision drive control is one of the mainstream methods for improving the running precision of a stepping motor and reducing running jitter and noise, and the rotation of the original one-step running is subdivided into multi-step running by regularly setting the current flowing through a motor coil, so that the step angle and the step oscillation kinetic energy are reduced. Common subdivision modes include a half-step mode, an 1/4 step mode, a 1/8 step mode, and the like, that is, a pulse is input, and the stepping motor rotates 1/2, 1/4, 1/8 steps and the like. A conventional stepping motor control system is shown in fig. 1, and is composed of an MCU controller, a stepping controller, a power amplifier, and a stepping motor. The subdivision driving implementation structure is shown in fig. 2 and comprises a mode controller, a sin counter and a sin decoder. The direction control input sets the sin counter to accumulate or subtract, the pulse input sets the sin counter to count the frequency, and the mode control module sets the sin counter to count and step. When the step controller receives a pulse, the sin counter accumulates a step value once, and sets a corresponding current through the sin decoder, and the stepping motor rotates by a corresponding step angle. However, the traditional subdivision mode is determined, the stepping is fixed, and the running noise and the running jitter of the motor cannot be well reduced.
Disclosure of Invention
The invention mainly solves the problems that the subdivision mode of a stepping motor is determined, the stepping is fixed, the running noise of the motor cannot be well reduced and the running jitter of the motor can not be reduced in the prior art, and provides a stepping motor control system and a stepping motor control method based on pulse frequency conversion control. The input of the preceding stage pulse is not required to be changed, the minimum stepping value is adopted, the frequency conversion processing is carried out on the input pulse, the stepping motor can always work at the highest hardware subdivision precision, the motor control precision is improved, and the subdivision control upgrading of the original stepping motor system is facilitated.
The technical problem of the invention is mainly solved by the following technical scheme: a stepping motor control system based on pulse frequency conversion control comprises an MCU controller, a stepping controller, a power amplifier and a stepping motor, wherein the MCU controller sends pulse and direction control information to the stepping controller, the stepping controller is connected with the input end of the power amplifier, the output end of the power amplifier is connected with the stepping motor, the stepping controller comprises a mode control module, a pulse frequency conversion module, a sin counter and a sin decoder,
a mode control module: inputting a subdivision mode, calculating frequency multiplication according to the highest subdivision of the stepping controller of the input subdivision mode, and sending the frequency multiplication to the pulse frequency conversion module;
pulse frequency conversion module: carrying out frequency conversion processing on the input pulse according to the frequency multiplication, and outputting a new pulse to a sin counter;
sin counter: acquiring direction control information, and accumulating a stepping value according to the new pulse after frequency conversion; wherein the direction control information is used to set the sin counter to increment or decrement.
sin decoder: and setting the accumulated stepping value as corresponding current, transmitting the current to a stepping motor after the current is processed by a power amplifier, and converting the current into a corresponding stepping angle by the stepping motor.
The traditional subdivision mode is determined, the stepping is fixed, the invention abandons subdivision control of pulse accumulation one step by one step, adopts the minimum stepping value, and simultaneously carries out frequency conversion processing on input pulses, so that the motor can be subdivided and operated with the highest hardware precision no matter in which subdivision mode, and the rotation of the stepping motor is more silent, stable and coherent. The invention improves the subdivision precision of the stepping motor without improving the input frequency of the master control pulse, and can be conveniently applied to subdivision control upgrading of the original stepping motor control system. The MCU controller outputs pulse and direction control information, the sin decoder converts the pulse and the direction control information into corresponding current according to the count value of the sin counter, the power amplifier amplifies the current output by the stepping controller, and the stepping motor converts the current into a corresponding stepping angle.
As a preferable scheme, the pulse frequency conversion module comprises a width counter, a shifter and a microstep counter, the width counter is connected with the shifter, the input of the shifter is connected with the mode control module, the output of the shifter is connected with the microstep counter, the output of the microstep counter is connected with the sin counter,
the width counter is used for calculating the pulse width value of the input pulse and sending the pulse width value to the shifter; the width counter counts the number of system clocks between two adjacent rising edges or two falling edges of the input pulse, and the counted clock number is the pulse width value of the current pulse of the input pulse.
The shifter receives the frequency multiplication information and calculates a new pulse width value after frequency conversion according to frequency multiplication; the shifter shifts the pulse width value according to the input frequency multiplication, calculates a new pulse width value, specifically, the new pulse width value can be obtained by dividing the pulse width value by the frequency multiplication, and simultaneously, the number of new pulses generated in the current input pulse period is determined according to the frequency multiplication, and the new pulses are sent to the microstep counter.
And the microstep counter counts by taking the new pulse width value as a counting period, generates a pulse when counting to the new pulse width value, clears zero to count again, and repeatedly counts to generate the new pulse after frequency conversion. And taking the new pulse width value as a counting period to count the number of clocks, wherein the counting can be from 0 to the new width value, or from 0 to the new pulse width value by counting down. And generating a pulse after accumulating the clock number to a new pulse width value every time, clearing and counting again, repeating the counting action to output the new pulse after frequency conversion, and inputting the new pulse to the sin counter.
As a preferable scheme, the microstep counter comprises an integer counter and a decimal counter, the output of the shifter is respectively connected with the integer counter and the decimal counter, the decimal counter is connected with the integer counter, the output of the integer counter is connected with the sin counter,
the integer counter is used for acquiring an integer value of the new pulse width value, counting by taking the integer value as a counting period, generating a new pulse every time the integer value is counted, clearing and recounting, and repeatedly counting to generate the new pulse after frequency conversion; the integral value is taken as a counting period, the system clock number is counted, when the accumulated count reaches the integral value, a new pulse is generated, and the integral counter is cleared. And then counting the next counting period until generating pulses with a set frequency multiplication number to form new pulses or generating new pulses with corresponding period length in the period of the current input pulse.
And the decimal counter acquires a decimal value of a new pulse width value, accumulates the decimal value once every time a new pulse is generated in the integer counter, generates a carry when the accumulated value reaches an integer, sends the carry to the integer counter, reserves the decimal part of the accumulated value, and subtracts 1 from the count value after the integer counter receives the carry. In the scheme, the small value is accumulated when the integer counter generates a new pulse, the initial value of the accumulated value is the small value, the small value is accumulated once when the first new pulse is generated, the accumulated value is the two small value, when the accumulated value reaches the integer, the accumulated value is the integer or has an integer part, specifically equal to or more than 1, a carry is generated, the small value counter removes the integer part of the accumulated value, the small part of the accumulated value is reserved, and accumulation is continued. The mic step counter counts up, the integer counter counts down by 1 after receiving the carry, and if the mic step counter counts down, the integer counter counts up by 1 after receiving the carry.
Since the pulse width value (integral multiple of the system clock) of the input pulse is not always divisible by the frequency of the multiple, the situation that the calculated new pulse width value is fractional occurs, and in order to more uniformly generate new pulses, the microstep counter is divided into an integer counter and a fractional counter. The decimal counter accumulates decimal values once every time a new pulse is generated, and generates a carry to the integer counter when the accumulated value reaches an integer. And adding 1 to the count value of the integer counter every time a system clock comes, subtracting 1 from the count value if the decimal counter carries a carry bit, generating a new pulse when the count value of the integer counter reaches a new pulse width value, clearing and then counting again. The counting ensures that the circuit can generate new pulse with uniform frequency multiplication under the condition that the pulse width value of the input pulse cannot be divided by the frequency multiplication factor.
As a preferred scheme, the pulse frequency conversion module also comprises a step counter and a difference calculator, wherein the input end of the step counter is connected with the MCU controller, the output end of the step counter and the output end of the sin counter are respectively connected with the input end of the difference calculator, the output end of the difference counter is respectively connected with the integer counter and the sin counter,
a step counter for counting an input pulse step value;
and the difference calculator is used for carrying out phase difference on the input pulse stepping value and the new pulse stepping value, sending the stepping difference value to the integer counter and the sin counter, controlling the generation quantity of the new pulses by the integer counter according to the stepping difference value, and adding the stepping difference value of the previous period to the sin counter after the new input pulse period begins. The input pulse can be subjected to frequency change, because the pulse width of a new pulse in the current period depends on the pulse width value of the input pulse in the previous period, when the frequency of the input pulse is changed, the condition that the frequency multiplication of the new pulse is unequal to a set value can occur in the first period of the change of the pulse width of the input pulse, so that the stepping motor can step or step out, and through the difference value control processing of the scheme, the stepping controller can be ensured to accurately step and operate under the condition of different input pulses.
A stepping motor control method based on pulse frequency conversion control comprises the following steps:
s1, inputting pulse and direction control information to a step controller by an MCU (microprogrammed control Unit);
s2, calculating a pulse width value of an input pulse, and calculating a new pulse value of the pulse after frequency conversion according to a set frequency multiplication;
s3, counting by taking the new pulse width value as a counting period, generating a pulse when the new pulse width value is counted, and repeatedly counting to generate a new pulse after frequency conversion;
and S4, setting corresponding current according to the accumulated step value of the new pulse after frequency conversion, and converting the current into a corresponding step angle by a stepping motor.
The traditional subdivision mode is determined, the stepping is fixed, the invention abandons subdivision control of pulse accumulation one step by one step, adopts the minimum stepping value, and simultaneously carries out frequency conversion processing on input pulses, so that the motor can be subdivided and operated with the highest hardware precision no matter in which subdivision mode, and the rotation of the stepping motor is more silent, stable and coherent. The invention improves the subdivision precision of the stepping motor without improving the input frequency of the master control pulse, and can be conveniently applied to subdivision control upgrading of the original stepping motor control system.
As a preferable scheme, the specific process of step S2 includes:
s21, two adjacent rising edges in the input pulse are detected, and a pulse is arranged between the two rising edges; alternatively, a pulse may be formed between two adjacent falling edges.
S22, counting the number of system clocks in the pulse range, wherein the counted clock number is the pulse width value of the current pulse;
and S23, obtaining an input subdivision mode and the highest subdivision of the step controller, calculating frequency multiplication = the input subdivision mode/the highest subdivision of the step controller, and dividing the pulse width value by the frequency multiplication to obtain a new pulse width value after frequency conversion. Specifically, the pulse width value is divided by the frequency multiplication factor to obtain a new pulse width value, and the number of new pulses generated in the current input pulse period is determined according to the frequency multiplication factor. The frequency multiplication number is determined by the set subdivision mode and the highest subdivision precision of the current motor step controller, for example, the input 1/8 subdivision mode, and the step controller highest subdivision 1/256 is taken as an example, so that the frequency multiplication number is 32 frequency multiplication, that is, the input subdivision mode is converted into the corresponding frequency multiplication number according to the highest subdivision precision of the step controller.
As a preferable scheme, the specific process of step S3 includes:
s31, obtaining an integer value and a decimal value of the new pulse width value;
s32, counting by taking the integer value as a counting period, judging whether a carry exists or not, if the carry exists, subtracting 1 from the counting value, and if the carry does not exist, counting according to a normal mode;
s33, when the integer value is counted, generating a new pulse, and clearing the count;
at the same time, accumulating the decimal value once when a new pulse is generated, generating a carry when the accumulated value reaches an integer, sending the carry to an integer counter, and reserving the decimal part of the accumulated value;
s34, repeating the steps 32-33 until a new pulse after frequency conversion is generated.
As a preferable scheme, after the new pulse accumulated step value is obtained in step S4, the method further includes a difference control processing step, including:
s41, when a step counter detects an input pulse, taking a frequency multiplication value as an input pulse step value to obtain an input pulse step value; the step counter is set according to the frequency multiplication, and when the frequency multiplication is 4, counting is carried out to obtain a step value of 4 when detecting an input pulse.
S42, acquiring a new pulse stepping value; the accumulated sin counter outputs a step value of a new pulse in the current period.
S43, carrying out phase difference on the input pulse stepping value and the new pulse stepping value to obtain a stepping difference value, sending the stepping difference value to an integer counter, and controlling the generation quantity of new pulses; the integer counter prevents the generation of a new pulse when the step difference is 0.
And S44, detecting whether the current operation period is finished or not, if not, returning to the step S42, if so, sending the stepping difference value to the sin counter, and adding the stepping difference value of the previous period to the sin counter after the new input pulse period starts. The operation period is the period of the current input pulse, and the generation of the new pulse is completed in the operation period when the current operation period is ended.
The input pulse can be subjected to frequency change, because the pulse width of a new pulse in the current period depends on the pulse width value of the input pulse in the previous period, when the frequency of the input pulse is changed, the condition that the frequency multiplication of the new pulse is unequal to a set value can occur in the first period of the change of the pulse width of the input pulse, so that the stepping motor can step or step out, and through the difference value control processing of the scheme, the stepping controller can be ensured to accurately step and operate under the condition of different input pulses.
Therefore, the invention has the advantages that: adopt minimum step value, carry out frequency conversion to input pulse simultaneously for the motor can both be with the highest precision subdivision operation of hardware under which kind of subdivision mode, and step motor rotates more silence, steady, coherent. .
Drawings
FIG. 1 is a schematic diagram of a control system for a stepping motor in the prior art;
FIG. 2 is a schematic diagram of a stepper controller in the prior art;
FIG. 3 is a schematic diagram of a stepper controller according to the present invention;
FIG. 4 is a schematic diagram of a pulse frequency conversion module according to the present invention;
FIG. 5 is a schematic diagram of an input pulse anti-multi-step process;
fig. 6 is a schematic diagram of input pulse anti-loss step processing.
Detailed Description
The technical scheme of the invention is further specifically described by the following embodiments and the accompanying drawings.
Example (b):
the embodiment of a stepping motor control system based on pulse frequency conversion control is shown in fig. 1 and comprises an MCU controller, a stepping controller, a power amplifier and a stepping motor, wherein the MCU controller sends pulse and direction control information to the stepping controller, the stepping controller is connected with an input end of the power amplifier, an output end of the power amplifier is connected with the stepping motor, and the stepping controller comprises a mode control module, a pulse frequency conversion module, a sin counter and a sin decoder, as shown in fig. 3.
A mode control module: inputting a subdivision mode, calculating frequency multiplication according to the highest subdivision of the stepping controller of the input subdivision mode, and sending the frequency multiplication to the pulse frequency conversion module;
pulse frequency conversion module: carrying out frequency conversion processing on the input pulse according to the frequency multiplication, and outputting a new pulse to a sin counter;
sin counter: acquiring direction control information, and accumulating a stepping value according to the new pulse after frequency conversion; the direction control information is used to set the sin counter to increment or decrement.
sin decoder: and setting the accumulated stepping value as corresponding current, transmitting the current to a stepping motor after the current is processed by a power amplifier, and converting the current into a corresponding stepping angle by the stepping motor.
As shown in FIG. 4, the pulse frequency conversion module comprises a width counter, a shifter, a microstep counter, wherein the width counter is connected with the shifter, the input of the shifter is connected with the mode control module, the output of the shifter is connected with the microstep counter, the output of the microstep counter is connected with the sin counter,
the width counter counts the number of system clocks between two adjacent rising edges of the input pulse, the counted clock number is the current pulse width value of the input pulse, and the pulse width value is sent to the shifter;
the shifter receives the frequency multiplication information and calculates a new pulse width value after frequency conversion according to frequency multiplication; the specific calculation is to divide the pulse width value by the frequency multiplication number to obtain a new pulse width value, determine the number of new pulses generated in the current input pulse period according to the frequency multiplication number, and send the new pulse number to the microstep counter.
And the microstep counter counts the clock number by taking the new pulse width value as a counting period, generates a pulse after accumulating the clock number to the new pulse width value every time, clears the pulse to count again, repeats counting action to output the new pulse after frequency conversion, and inputs the new pulse to the sin counter.
Since the pulse width value (integral multiple of the system clock) of the input pulse is not always divisible by the frequency of the multiple, the situation that the calculated new pulse width value is fractional occurs, and in order to more uniformly generate new pulses, the microstep counter is divided into an integer counter and a fractional counter.
The microstep counter comprises an integer counter and a decimal counter, the output of the shifter is respectively connected with the integer counter and the decimal counter, the decimal counter is connected with the integer counter, the output of the integer counter is connected with the sin counter,
the integer counter is used for acquiring an integer value of the new pulse width value, counting by taking the integer value as a counting period, generating a new pulse every time the integer value is counted, clearing and recounting, and repeatedly counting to generate the new pulse after frequency conversion; the integral value is taken as a counting period, the system clock number is counted, when the accumulated count reaches the integral value, a new pulse is generated, and the integral counter is cleared. And then counting the next counting period until generating pulses with a set frequency multiplication number to form new pulses or generating new pulses with corresponding period length in the period of the current input pulse.
And the decimal counter acquires a decimal value of a new pulse width value, accumulates the decimal value once every time a new pulse is generated in the integer counter, generates a carry when the accumulated value reaches an integer, sends the carry to the integer counter, reserves the decimal part of the accumulated value, and subtracts 1 from the count value after the integer counter receives the carry. The small value accumulation is carried out when the integer counter generates a new pulse, the initial value of the accumulated value is the small value, when the first new pulse is generated, the small value is accumulated once, the accumulated value is two small value accumulated values, when the accumulated value reaches the integer, the accumulated value is the integer or has an integer part, specifically equal to or more than 1, the carry is generated and sent to the integer counter, the small value counter removes the integer part of the accumulated value, the small value part of the accumulated value is reserved, and the accumulation is continued.
The input pulse can have frequency change, and because the pulse width of the new pulse in the current period depends on the pulse width value of the input pulse in the previous period, when the frequency of the input pulse changes, the first period of the change of the pulse width of the input pulse can have the condition that the frequency multiplication of the new pulse is unequal to the set value, so that the stepping motor can step or step out. Through the difference value compensation processing, the stepping controller can accurately run in a stepping mode under the condition of different input pulses.
The pulse frequency conversion module further comprises a step counter and a difference value calculator, wherein the input end of the step counter is connected with the MCU controller, the output end of the step counter and the output end of the sin counter are respectively connected with the input end of the difference value calculator, the output end of the difference value counter is respectively connected with the integer counter and the sin counter,
a step counter for counting an input pulse step value;
and the difference calculator is used for carrying out phase difference on the input pulse stepping value and the new pulse stepping value, sending the stepping difference value to the integer counter and the sin counter, controlling the generation quantity of the new pulses by the integer counter according to the stepping difference value, and adding the stepping difference value of the previous period to the sin counter after the new input pulse period begins.
The embodiment also comprises a stepping motor control method based on pulse frequency conversion control by adopting the system, which comprises the following steps:
s1, inputting pulse and direction control information to a step controller by an MCU (microprogrammed control Unit); wherein the direction control information is used to set the sin counter to increment or decrement. The specific input pulse is input to a width counter, and the direction information is input to a value sin counter. In the mode control, a subdivision mode is set, a corresponding frequency multiplication is calculated according to the subdivision mode, taking the highest subdivision 1/256 of the step controller as an example, if a 1/8 subdivision mode is set, the input pulse is subjected to uniform 32 frequency multiplication processing, namely 32 frequency multiplication is obtained, and 4 frequency multiplication is taken as an example in the embodiment.
S2, calculating a pulse width value of an input pulse, and calculating a new pulse value of the pulse after frequency conversion according to a set frequency multiplication; the specific process comprises the following steps:
s21, two adjacent rising edges in the input pulse are detected, and a pulse is arranged between the two rising edges;
s22, counting the number of system clocks in the pulse range, wherein the counted clock number is the pulse width value of the current pulse;
s23, obtaining the input subdivision mode and the highest subdivision of the step controller, calculating frequency multiplication = dividing the input subdivision mode/highest subdivision of the step controller, and dividing the pulse width value by the frequency multiplication, in this example, the input 1/64 subdivision mode, and the highest subdivision 1/256 of the step controller, then calculating the frequency multiplication to be 4, and then dividing the input pulse width value by 4 to obtain the new pulse width value after frequency conversion, that is, the new pulse width value is 1/4 of the original pulse period. The shifter can be a digital operation circuit and realizes division operation. Alternatively, a shift operation may be performed to shift the original pulse width by 2 bits to obtain a new pulse width, which is 1/4 times the original pulse period.
S3, counting by using the new pulse width value as a counting period by using a micro step counter, generating a pulse when counting to the new pulse width value, and repeatedly counting to generate a new pulse after frequency conversion; the specific process comprises the following steps:
s31, obtaining an integer value and a decimal value of the new pulse width value;
s32, counting by the integer counter with the integer value as a counting period, judging whether a carry exists, if the carry exists, subtracting 1 from the counting value, and if the carry does not exist, counting normally;
s33, when the integer value is counted, generating a new pulse, and clearing the count;
meanwhile, the decimal counter accumulates decimal values once every time a new pulse is generated, when the accumulated value reaches an integer, a carry is generated and sent to the integer counter, and the decimal part of the accumulated value is reserved; the small value accumulation is carried out when a new pulse is generated, the initial value of the accumulation value is a new pulse width value small value, when a first new pulse is generated, the small value is accumulated once, the accumulation value is an accumulation value of two small values, when the accumulation value reaches an integer, the accumulation value is an integer or has an integer part, specifically equal to or more than 1, a carry is generated, the small value counter removes the integer part of the accumulation value, the small value part of the accumulation value is reserved, and the accumulation is continued. Taking 4 times the frequency, for example, the pulse width value is 43, the generated new pulse width value is 10.75, the integer counter obtains the integer part 10, and the decimal counter obtains the decimal value 0.75. Accumulating when the integer counter generates a new pulse, generating a new pulse when the integer counter counts to 10, wherein the pulse width value of the new pulse is 10, accumulating the decimal value once by the decimal counter, adding the decimal value to 1.5, enabling the accumulated value to reach the integer, generating a carry and sending the carry to the integer counter, reducing the numerical value by 1 when the integer counter counts, removing the integral part of the accumulated value by the decimal counter, keeping the decimal part to be 0.5, and continuing accumulating.
S34, repeating the steps 32-33 until new pulses after frequency conversion are generated, namely, generating the set 4 new pulses.
And S4, setting corresponding current according to the new pulse accumulated step value after frequency conversion, and converting the current into a corresponding step angle by a step motor. The sin counter accumulates a stepping value once when receiving a pulse after frequency multiplication, the stepping value is the minimum stepping value under the highest precision of the current motor stepping controller, namely, the motor stepping controller can operate under the highest precision subdivision control of the motor stepping controller no matter which subdivision mode is input externally, and the accumulated value is the minimum stepping value of the input subdivision mode under the highest precision of the current hardware. In the embodiment, the highest subdivision 1/256 of the stepping controller and the subdivision mode of external input of 1/64 are taken as examples, the stepping controller is converted into a frequency multiplication mode of 4, no pulse is input externally, and the sin counter accumulates 4 minimum stepping values, so that the driving circuit meets the control of the 1/64 subdivision mode, the stepping motor rotates under the control of 1/256 subdivision all the time, the stepping angle and stepping oscillation are reduced, and the stepping motor rotates more silently, stably and continuously.
In addition, the method also comprises a difference value control processing step in the process of accumulating the new pulse, which comprises the following steps:
s41, when the step counter detects an input pulse, the step counter takes the frequency multiplication value as the step value of the input pulse to obtain the step value of the input pulse; the step counting rule of the step counter is set according to the frequency multiplication, and when the frequency multiplication is 4, counting is carried out to obtain a step value of 4 when an input pulse is detected.
S42, acquiring a new pulse stepping value; the step value of a new pulse is output by the accumulated sin counter in the current operation period, namely the current input pulse period;
s43, carrying out phase difference on the input pulse stepping value and the new pulse stepping value to obtain a stepping difference value, sending the stepping difference value to an integer counter, and controlling the generation quantity of new pulses;
and S44, detecting whether the current operation period is finished or not, if not, returning to the step S42, if so, sending the stepping difference value to the sin counter, and adding the stepping difference value of the previous period to the sin counter after the new input pulse period starts.
Still taking setting 4 times as an example, detecting that an input pulse obtains an input pulse step value of 4, obtaining an output new pulse step value plus 1 after outputting a new pulse, performing phase difference on the input pulse step value and the new pulse step value, calculating to obtain a step difference value, and sending the step difference value to an integer counter, wherein before the current period is not finished, the step difference value = 4-the new pulse step value is not 0, and the integer counter continues to generate the new pulse. When 4 new pulses are generated, the new pulse step value is accumulated to be 4, the step difference value obtained by calculation is 0, and the integer counter stops generating the new pulses until the current operation period is finished.
The input pulses may have frequency change, because the pulse width of the new pulse in the current period depends on the pulse width value of the input pulse in the previous period, as shown in fig. 5, where Ta0, Ta1, and Ta2 are each input pulse period, i.e., an operation period, where Taa0, Taa1, and Taa2 are periods of the first pulse in each operation period, respectively, and the pulse width values thereof are expressed as Taa 1= Ta0/4, Taa2= Ta1/4, Tbb1= Tb0/4, and Tbb2= Tb1/4, and when the frequency of the input pulses changes, the first period of the pulse width change of the input pulses may have a double frequency of the new pulse and an unequal set value, resulting in multiple steps or step loss of the stepping motor.
As shown in fig. 5, when the input pulse frequency becomes low, the input pulse width becomes wide, and after 4 new pulses are generated in period Ta1, the step difference value becomes 0, and the integer counter will remain constant, preventing the new pulses from being generated. When the input pulse frequency becomes high, the input pulse width becomes narrow, only 3 new pulses are generated in the Tb1 period, and the sin counter is added by the step difference 1 of the previous period at the first new pulse after the Tb2 period starts. The stepping controller can accurately run in a stepping mode under the condition of different input pulses.
The specific embodiments described herein are merely illustrative of the spirit of the invention. Various modifications or additions may be made to the described embodiments or alternatives may be employed by those skilled in the art without departing from the spirit or ambit of the invention as defined in the appended claims.

Claims (8)

1. The utility model provides a step motor control system based on pulse frequency conversion control, includes MCU controller, step controller, power amplifier and step motor, and the MCU controller sends pulse and direction control information to step controller, and step controller is connected with the power amplifier input, and step motor, its characterized in that are connected to the power amplifier output: the step controller comprises a mode control module, a pulse frequency conversion module, a sin counter and a sin decoder,
a mode control module: inputting a subdivision mode, calculating frequency multiplication according to the highest subdivision of the stepping controller of the input subdivision mode, and sending the frequency multiplication to the pulse frequency conversion module;
pulse frequency conversion module: carrying out frequency conversion processing on the input pulse according to the frequency multiplication, and outputting a new pulse to a sin counter;
sin counter: acquiring direction control information, and accumulating a minimum stepping value according to the new pulse after frequency conversion;
sin decoder: and setting the accumulated step value as corresponding current, transmitting the current to a stepping motor after the current is processed by a power amplifier, and converting the current into a corresponding step angle by the stepping motor.
2. The stepping motor control system based on the pulse frequency conversion control according to claim 1, wherein the pulse frequency conversion module comprises a width counter, a shifter and a microstep counter, the width counter is connected with the shifter, the input of the shifter is connected with the mode control module, the output of the shifter is connected with the microstep counter, the output of the microstep counter is connected with the sin counter,
the width counter is used for calculating the pulse width value of the input pulse and sending the pulse width value to the shifter;
the shifter receives the frequency multiplication information and calculates a new pulse width value after frequency conversion according to frequency multiplication;
and the microstep counter counts by taking the new pulse width value as a counting period, generates a pulse when counting to the new pulse width value, clears zero to count again, and repeatedly counts to generate the new pulse after frequency conversion.
3. The stepping motor control system based on pulse frequency conversion control as claimed in claim 2, wherein said microstep counter comprises an integer counter and a decimal counter, the output of the shifter is connected with the integer counter and the decimal counter respectively, the decimal counter is connected with the integer counter, the output of the integer counter is connected with the sin counter,
the integer counter is used for acquiring an integer value of the new pulse width value, counting by taking the integer value as a counting period, generating a new pulse every time the integer value is counted, clearing and recounting, and repeatedly counting to generate the new pulse after frequency conversion;
and the decimal counter acquires a decimal value of a new pulse width value, accumulates the decimal value once every time a new pulse is generated in the integer counter, generates a carry when the accumulated value reaches an integer, sends the carry to the integer counter, reserves the decimal part of the accumulated value, and subtracts 1 from the count value after the integer counter receives the carry.
4. The stepping motor control system based on pulse frequency conversion control according to claim 3, wherein the pulse frequency conversion module further comprises a step counter and a difference calculator, the input end of the step counter is connected with the MCU controller, the output ends of the step counter and the sin counter are respectively connected with the input end of the difference calculator, the output end of the difference counter is respectively connected with the integer counter and the sin counter,
a step counter for counting an input pulse step value;
and the difference calculator is used for carrying out phase difference on the input pulse stepping value and the new pulse stepping value, sending the stepping difference value to the integer counter and the sin counter, controlling the generation quantity of the new pulses by the integer counter according to the stepping difference value, and adding the stepping difference value of the previous period to the sin counter after the new input pulse period begins.
5. A stepping motor control method based on pulse frequency conversion control, which adopts the system in any one of claims 1-4, and is characterized by comprising the following steps:
s1, inputting pulse and direction control information to a step controller by an MCU (microprogrammed control Unit);
s2, calculating a pulse width value of an input pulse, and calculating a new pulse value of the pulse after frequency conversion according to a set frequency multiplication;
s3, counting by taking the new pulse width value as a counting period, generating a pulse when the new pulse width value is counted, and repeatedly counting to generate a new pulse after frequency conversion;
and S4, setting corresponding current according to the accumulated step value of the new pulse after frequency conversion, and converting the current into a corresponding step angle by a stepping motor.
6. The method as claimed in claim 5, wherein the step S2 includes the following steps:
s21, two adjacent rising edges in the input pulse are detected, and a pulse is arranged between the two rising edges;
s22, counting the number of system clocks in the pulse range, wherein the counted clock number is the pulse width value of the current pulse;
and S23, obtaining an input subdivision mode and the highest subdivision of the step controller, calculating frequency multiplication = the input subdivision mode/the highest subdivision of the step controller, and dividing the pulse width value by frequency multiplication to obtain a new pulse width value after frequency conversion.
7. The method as claimed in claim 6, wherein the step S3 includes the following steps:
s31, obtaining an integer value and a decimal value of the new pulse width value;
s32, counting by taking the integer value as a counting period, judging whether a carry exists or not, if the carry exists, subtracting 1 from the counting value, and if the carry does not exist, counting according to a normal mode;
s33, when the integer value is counted, generating a new pulse, and clearing the count;
at the same time, accumulating the decimal value once when a new pulse is generated, generating a carry when the accumulated value reaches an integer, sending the carry to an integer counter, and reserving the decimal part of the accumulated value;
s34, repeating the steps 32-33 until a new pulse with set frequency conversion is generated.
8. The method as claimed in claim 6, further comprising a difference control processing step after the new pulse accumulated step value in step S4, comprising:
s41, when a step counter detects an input pulse, taking a frequency multiplication value as an input pulse step value to obtain an input pulse step value;
s42, acquiring a new pulse stepping value;
s43, carrying out phase difference on the input pulse stepping value and the new pulse stepping value to obtain a stepping difference value, sending the stepping difference value to an integer counter, and controlling the generation quantity of new pulses;
and S44, detecting whether the current operation period is finished or not, if not, returning to the step S42, if so, sending the stepping difference value to the sin counter, and adding the stepping difference value of the previous period to the sin counter after the new input pulse period starts.
CN202110533870.5A 2021-05-17 2021-05-17 Stepping motor control system and method based on pulse frequency conversion control Active CN113258842B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110533870.5A CN113258842B (en) 2021-05-17 2021-05-17 Stepping motor control system and method based on pulse frequency conversion control

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110533870.5A CN113258842B (en) 2021-05-17 2021-05-17 Stepping motor control system and method based on pulse frequency conversion control

Publications (2)

Publication Number Publication Date
CN113258842A true CN113258842A (en) 2021-08-13
CN113258842B CN113258842B (en) 2022-05-06

Family

ID=77182289

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110533870.5A Active CN113258842B (en) 2021-05-17 2021-05-17 Stepping motor control system and method based on pulse frequency conversion control

Country Status (1)

Country Link
CN (1) CN113258842B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114347679A (en) * 2021-12-31 2022-04-15 东莞市启思达智能技术有限公司 Variable-precision signal processing method and system

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010142043A (en) * 2008-12-12 2010-06-24 Omron Corp Device and method for driving stepping motor, and program
CN202353511U (en) * 2011-02-25 2012-07-25 中国人民解放军第二炮兵工程学院 Driver for extra-high subdivision stepping motor
CN104317253A (en) * 2014-10-27 2015-01-28 浙江理工大学 System method for servo motor position control
CN105048902A (en) * 2015-08-06 2015-11-11 杭州瑞盟科技有限公司 Micro-stepping low-noise stepping motor driving controller
US20160042901A1 (en) * 2014-08-06 2016-02-11 Whirlpool Corporation Methods, apparatus and articles of manufacture to regulate relay coil switching
CN205945576U (en) * 2016-07-05 2017-02-08 北京欣斯达特控制技术有限公司 Stepping motor driver
CN106941332A (en) * 2016-12-20 2017-07-11 广西风华服饰有限责任公司 A kind of sewing machine method for controlling stepping motor and control system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010142043A (en) * 2008-12-12 2010-06-24 Omron Corp Device and method for driving stepping motor, and program
CN202353511U (en) * 2011-02-25 2012-07-25 中国人民解放军第二炮兵工程学院 Driver for extra-high subdivision stepping motor
US20160042901A1 (en) * 2014-08-06 2016-02-11 Whirlpool Corporation Methods, apparatus and articles of manufacture to regulate relay coil switching
CN104317253A (en) * 2014-10-27 2015-01-28 浙江理工大学 System method for servo motor position control
CN105048902A (en) * 2015-08-06 2015-11-11 杭州瑞盟科技有限公司 Micro-stepping low-noise stepping motor driving controller
CN205945576U (en) * 2016-07-05 2017-02-08 北京欣斯达特控制技术有限公司 Stepping motor driver
CN106941332A (en) * 2016-12-20 2017-07-11 广西风华服饰有限责任公司 A kind of sewing machine method for controlling stepping motor and control system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
孙国夏: "《步进电机的步距细分与平滑控制》", 《外国自动化》 *
王邦继: "《FPGA在多轴步进电机控制器中的应用》", 《电机与控制学报》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114347679A (en) * 2021-12-31 2022-04-15 东莞市启思达智能技术有限公司 Variable-precision signal processing method and system

Also Published As

Publication number Publication date
CN113258842B (en) 2022-05-06

Similar Documents

Publication Publication Date Title
JP2014066717A (en) Frequency measuring device
CN113258842B (en) Stepping motor control system and method based on pulse frequency conversion control
CN1940808A (en) Compensated-clock generating circuit and usb device having same
JP2019039882A5 (en)
JP6481533B2 (en) Digitally controlled oscillator circuit
CN105471433A (en) Sample rate converter, an analog to digital converter and a method of converting a data stream
CN113498623B (en) Time synchronization method and device and network node equipment
CN101226408B (en) AC servo absolute value encoder position feedback pulse frequency dividing output method and circuit
CN103873017A (en) Device and method for improving pulse edge time resolution
CN101217277B (en) A non-integer frequency difference eliminator and phase-lock loop that can product non-integer real-time clock signal
CN101783676B (en) Method and device for clock division
JP5549700B2 (en) Signal generator and frequency synthesizer
CN113315426B (en) Driving device of stepping motor and motor system
JP6772998B2 (en) A / D conversion circuit
CN101594147A (en) Phase-locked loop circuit
JP2010011389A (en) Frequency divider
CN107153352A (en) A kind of pulse generation method based on digital frequency synthesis technology
JPH05252153A (en) Digital loop filter
JP6903543B2 (en) ABZ phase divider
CN109391267A (en) Shake when using digital PLL S with ADCS and DAC reduces technology
CN214315114U (en) Micro-step motor counting sequence circuit
JP4614129B2 (en) Network load tester
JP3967370B1 (en) Digital pulse width modulator
CN112910338A (en) Micro-step motor counting sequence circuit
JP6161682B2 (en) Signal period detection device and signal period detection method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant