Request C language programming for MCU control stepper motor

Updated on technology 2024-03-20
11 answers
  1. Anonymous users2024-02-07

    The requirements you describe are not very clear, they should be described step by step, and the requirements for each step are written out step by step, so that everyone can easily understand.

    See what you mean!

    If there are only two ports to control the stepper motor, an additional stepper motor driver is required.

    The control direction is 1 (0) the motor forward and the 0 (1) stepper motor backward.

    To control the number of steps and speed, you can use a PWM to control it directly. The higher the PWM frequency, the faster the speed, but the number of steps taken is calculated in the timer interrupt to determine how far you have gone.

    As for the interrupt signal you mentioned, you can use the method of cyclic scanning to scan the input interrupt signal in the program, and when the signal is detected, the level that changes can be lit up

  2. Anonymous users2024-02-06

    The stepper motor driver on the first floor needs a clock externally, a forward and reverse control signal, with such a chip is naturally simple, its practical single-chip microcomputer itself can generate the stepper motor drive signal can also be, it needs to add transistor drive circuit (increase the role of driving power), in order to accurately move the distance, first of all, you have to calculate the total angle to be turned according to the pitch (how many laps and how many pulses).

    As for the interrupt signal, it can be set to be triggered by the falling edge (the level trigger will cause multiple responses), and the main cycle in the main function (fixed information such as the number of cycles is set) is used to generate the drive signal without entering the motor.

  3. Anonymous users2024-02-05

    The first question you said is right.,The second can be counted.,How many pulses are there in a circle?,Clear after a week.,But there's an error when you click on the rotation itself.,Maybe those pulses can't turn the required angle after that.,Or it will turn more.,You can use a code disc here.。

  4. Anonymous users2024-02-04

    2: Only set the starting detection point on the circumference.

  5. Anonymous users2024-02-03

    I want to know:

    1. How to display the current turning angle in real time?

    Depending on the parameters you use with the stepper motor, such as the step angle.

    Is it the number of pulses multiplied by the step angle?

    Right. 2. How to set a fixed initial position of 0 degrees in the microcontroller, and the angle value will be cleared to zero after the motor rotates for one (360 degrees)?

    Photoelectric, Hall and other sensors are used to determine the position of 0 degrees.

    After the boot reset, the shilling motor is turned to the 0 degree position.

    Later, the number of degrees turned is multiplied by the number of pulses by the step angle.

  6. Anonymous users2024-02-02

    You can use a high-precision multiturn potentiometer.

    The voltage range for each angle of the voltage division is stored in advance.

    In this way, no matter where the startup is started, as long as the voltage signal is read, the range is calculated, and the angle is known.

    Even if it has been artificially rotated, the correct angle can be read when powered on.

    This method is relatively safe, the angle of rotation cannot be obtained immediately with the code disc, and the angle must be reset to obtain the angle.

  7. Anonymous users2024-02-01

    It's so complicated, so I suggest you go to the library and look for relevant materials.

  8. Anonymous users2024-01-31

    51. Monolithic stepper motor control principle and control design program.

    51 monolithic stepper motor is a digital control motor, it converts the pulse signal into angular displacement, that is, to give a pulse signal, the stepper motor rotates an angle, so it is very suitable for single-chip microcomputer control. Stepper motors can be divided into reactive stepper motors (referred to as VR), permanent magnet stepper motors (referred to as PM) and hybrid stepper motors (abbreviated as HB).

    The biggest feature of 51 monolithic stepper motor is that it is controlled by input pulse signal, that is, the total rotation angle of the motor is determined by the number of input pulses, and the speed of the motor is determined by the pulse signal frequency.

    The driving circuit of 51 single-chip stepper motor works according to the control signal, and the control signal is generated by the single-chip microcomputer. Its basic principles work as follows:

    1) Control the commutation sequence.

    The process of energizing commutation is called pulsed nuclear pulsation. For example, the three-beat working mode of the three-phase stepper motor, the energizing sequence of each phase is A-B-C D, and the energizing control pulse must be strictly in accordance with this order to control the on-off of the a, b, c, and d phases.

    2) control the steering of the single-piece inlet motor of step 51.

    If the working mode is commutated in positive sequence, the stepper motor rotates forward, and if it is energized in reverse order, the motor is reversed.

    3) Control the speed of 51 monolithic stepper motors.

    If you give a control pulse to the stepper motor, it will rotate one step, and send another pulse, and it will rotate one step more. The shorter the interval between the two pulses, the faster the stepper motor will spin. Adjust the pulse frequency emitted by the single-chip microcomputer, and the speed of the stepper motor can be adjusted.

    Stepper motor is a commonly used actuator in electromechanical control, its purpose is to convert electrical impulses into angular displacement, in layman's terms: when the stepper driver receives a pulse signal, it will drive the stepper motor to rotate a fixed angle (and stepping angle) in the set direction. By controlling the number of pulses, the angular displacement can be controlled, so as to achieve the purpose of accurate positioning; At the same time, the speed and acceleration of the motor rotation are controlled by controlling the pulse frequency, so as to achieve the purpose of speed regulation.

  9. Anonymous users2024-01-30

    What role does the driver play in the MCU control of the stepper motor?

    The control system will only send forward rotation, reverse rotation and stop signals, and this control signal should be received, amplified and output to the stepper motor for execution.

    The role of the drive is to amplify.

    Are stepper motors in most applications typically with or without a driver?

    A stepper motor is a motor, and you need a separate driver. Generally, it will be: the combination of control system + driver + stepper motor.

    The control system gives the direction pulse, the step pulse, and the motor enable signal driver controls the stepper motor rotation.

  10. Anonymous users2024-01-29

    In fact, the main part of stepper motor control is an H-bridge to control the forward and reverse flow of current, and a two-phase stepper motor requires two H-bridges. The driver also includes a power supply (providing DC) and switching control circuitry. Functional performance varies widely, and it's hard to say.

    In addition, there are some modules with two H-bridges (such as L298 Darlington tube, LMD18200, L6205, Sanyo's can't remember clearly, you can go to his official website to see.) This module has a current cap of several amperes. It is necessary for the single-chip microcomputer to provide PWM, control signals and interpolation functions, etc., and it is more inclined to software implementation, which can flexibly realize the desired function.

    There is also a subdivision function).There are also some small voltage 12V1 2A modules suitable for small power motors. The reason for the MOS tube is 12V is a hurdle.

    There is no need to build an H-bridge yourself, unless you can't find a suitable drive module.

  11. Anonymous users2024-01-28

    The load of the motor is relatively large, and the motor cannot be driven directly by single-chip microcomputer, so the single-chip microcomputer control motor has to add a driver.

    To put it simply, the driver increases the wirepack current that controls the motor.

    The input line of the stepper motor has a common terminal and several signal lines (the number of signal lines depends on how many lines the motor is, each line controls a certain angle), the common termination of the positive (or negative) of the power supply, the signal line is given to the low level (or high level) in a certain order, and the motor can be turned.

Related questions
4 answers2024-03-20

The introductory course of MCU C language programming is not difficult, it is not easy to say, and the first thing to understand is to understand what these two things are when learning MCU C language? The introductory programming of single-chip microcomputer is mainly to learn C language, followed by circuit and programming language. >>>More

4 answers2024-03-20

You use a P1 port to control the dynamic scanning of 8 digital tubes, and the dynamic scanning display of digital tubes needs to be blanked. >>>More

9 answers2024-03-20

The method of using two timers is to use the timer t0 to control the frequency and the timer t1 to control the duty cycle. The general programming idea is as follows: the t0 timer interrupt makes an i0 port output high, and starts the timer t1 in the interrupt of the timer t0, and this t1 makes the io port output low, so that changing the initial value of timer t0 can change the frequency, and changing the initial value of timer t1 can change the duty cycle. >>>More

12 answers2024-03-20

If the timer count value is not enough, you can first set the sum number of 1, such as 1ms, and then add another number to 10 to 100ms to get the 1s time.

5 answers2024-03-20

8086 belongs to the micro process unit (MPU) and is a microprocessor. >>>More