Stepper motors are widely used in various automation control systems and are key components in mechatronics devices. This is a digitally controlled motor, which is an actuator that converts electrical pulses into angular displacement. It controls the angular displacement and rotation speed of the motor by controlling the number and frequency of pulses, thereby achieving accurate positioning and speed regulation. .
The digital electrical pulse signals (i.e., square wave control signals) required by traditional stepper motors are generally generated with the help of digital logic circuits. With the continuous development of embedded technology, microcontrollers are more widely used, and there are more and more occasions where such pulse signals are generated by microcontrollers at regular intervals. Microcontroller timing control pulses generally have two methods: software timing and timer timing. The former method takes up most of the CPU's working time, so timer interrupts are often used to generate pulse signals. Since most of the interrupt response times of general microcontroller systems are above 10Us, the accuracy of pulses generated by timer interrupts is generally above 10Us, which often cannot meet the high-precision requirements of stepper motor speed control. In order to improve the accuracy of pulse control, the author uses the programmable timing controller in the H8/3062F microcontroller of Renesas' H8/300H series for pulse control, so that the corresponding time of the pulse signal output reaches 0. 1Us level, thus meeting the high-precision requirements of stepper motor speed control.
1 Programmable Timing Pattern Controller TPC
Programmable Timing Pattern Controller TPC is a functional module unique to Renesas' H8/300H series microcontrollers. It uses a 16-bit timer as a time base to provide various patterns of pulse output. Figure 1 is the structural block diagram of TPC. The pulse output of TPC is divided into 4 groups that can operate independently at the same time. Each group has 4 bits and is triggered by the comparison match signal of the 4 channels of the timer. TPC borrows a total of 16 pins TP15~TP0 from port B and port A as its output, which can be opened bit by bit and can control up to 16 pulse outputs. The output data is composed of the data registers PBDR and PADR of the two ports and subsequent data registers. Provided by NDRB and NDRA. The port data direction registers PADDR and PBDDR are used to control the input or output of the pin; the subsequent data enable registers NDERA and NDERB are used to open or close the TPC port output; the TPC output mode register TPMR is used to select the output mode of each group of TPC ; The output control register TPCR is used to select the trigger signal source of each group of TPC, that is, which channel of the timer is triggered. Among them, the timer of the microcontroller H8/3062F has 3 channels, and each channel has 3 registers: timing counter TCNT, general registers GRA and GRB.
TPC has two output modes, namely non-overlapping output and normal output. The output mode of each group of TPC can be selected through the output mode register TPMR. The non-overlapping output method ensures a non-overlapping margin between pulse outputs. In the general register GRB of this channel, set the output trigger period of the non-overlapping TPC output waveform, then the non-overlapping margin is placed in GRA, and the output value will be triggered when the A comparison match event and the B comparison match event occur. In the normal output mode, the output trigger period of the TPC output waveform is set in GRA, and the TPC outputs the signal when the A comparison match event occurs. According to the pulse control requirements of the stepper motor, the normal output mode is used here.
The principle of TPC for stepper motor pulse control is as follows: first, select the general register GRA as the output comparison register; then, place the next output port value of TPC into the subsequent data register NDRA (NDRB), and then start the timer. A compare match event occurs when an interrupt request is issued. In the process of studying the TPC output timing, it was discovered that the TPC does not send the value to the TPC port during the interrupt response process, but 3 clock cycles after the A comparison match event occurs, the value placed in the subsequent data register is placed in advance. Sent to the port data register PADR (PBDR), the output value of the TPC is updated. Since the clock frequencies of the H8/3062F series microcontrollers are above 20 MHz, this requires less than 0. The port signal can be sent in 2ms, which greatly shortens the response time. It is dozens or even hundreds of times faster than the general microcontroller that sends the port signal during the scheduled interrupt process, thus making the pulse control more accurate. In the interrupt subroutine, the values of the subsequent data register NDRA (NDRB) and the output comparison register GRA are updated, thereby changing the pulse frequency to achieve speed regulation of the asynchronous motor. Figure 2 is a schematic diagram of generating pulse frequency changes. In the figure, GRA, GRA' and GRA" abstractly represent three different GRA values, thus demonstrating the impact of changes in GRA values on the pulse frequency.
adopts the TP15 pin of the TPC of H8/3062F and the P1 of the I/O port. O controls the speed and direction of the stepper motor respectively. The pulses output by TP15 are sent to the motor drive control circuit composed of power tubes, so that the power tubes work in the switching state. When the stepper motor stops, the output of TP15 remains high. In this way, when TP15 outputs a negative pulse, the power tube is turned on, thereby making the stepper motor move forward one step. The speed regulation of the stepper motor is achieved by controlling the pulse frequency output by TP15. P1.0 controls the running direction of the stepper motor. When P1.When the O output is high, the stepper motor moves forward; otherwise, it moves backward.
The pulse frequency at which a stepper motor can start normally under load is called the "stepper motor starting frequency". If the pulse frequency is higher than this value, the motor will not start normally and may lose steps or stall; similarly, the stepper motor should brake at the starting frequency when braking. If the motor is to rotate at high speed, the pulse frequency should have an acceleration process, that is, the starting frequency is low, and then rises to the desired high frequency at a certain acceleration (the deceleration process is reversed). A more ideal starting curve should start according to the exponential law. Different starting frequencies and different exponential curves should be selected according to the user's load conditions to find the most ideal curve.
Generally, during the operation control process, the "step-up speed method" is used to continuously increase the speed to the required speed, and the operating speed conversion time according to the preset curve should be as short as possible. In order to shorten the speed conversion time, the method of establishing a data table can be used. A continuous data table can be established by combining the frequency of each curve segment and the step frequency between each segment. After many "test runs", the GRA values corresponding to 256 pulse frequencies were calculated. Among them: the first one is the GRA value corresponding to the starting frequency of the stepper motor; the last one is the GRA value corresponding to the maximum pulse frequency of the stepper motor, which is stored in the array during software programming and is used to change the pulse frequency to realize control of the stepper motor. acceleration and deceleration control. The deceleration and braking process is the same as the acceleration and start-up process. Figure 3 is a schematic diagram of the step speed up start.
The software part consists of 1 main program and 3 subprograms (TPC initialization subprogram, timer initialization subprogram and interrupt subprogram). The program is written in C language. The TPC initialization subroutine sets TP15 as the output mode and the potential of the next output, and selects the output signal trigger source. The timer initialization subroutine selects the timer clock source and its counter clearing source, and turns on the scheduled interrupt. The interrupt subroutine realizes pulse output control, thereby realizing the speed regulation of the stepper motor. An important issue to consider in programming is the relationship between the distance from the target point and the pulse frequency position variable. This is the basis for whether to accelerate or decelerate. After calculation, it was found that when the distance from the target point is greater than the value in the pulse position variable plus 1, the stepper motor accelerates or maintains the highest operating speed; otherwise, it must slow down, otherwise it may not be able to stop at the starting frequency when it reaches the target point, thus causing braking failure.
Conclusion
Using the TPC in the H8/3062F microcontroller to control the pulse sequence of the stepper motor can make the stepper motor run faster and more accurately. It is dozens or even hundreds of times faster than the response speed of the general microcontroller control pulse, thus satisfying the need for stepper motor adjustment. Speed control accuracy requirements, and TPC can control up to 16 stepper motors to run synchronously, so it will be widely used in stepper motor speed regulation.
Previous article:Design of direct digital control system for SR motor based on two-step commutation control strategy
Next article:Field-oriented control of brushless motors using an ARM7 processor
Recommended ReadingLatest update time:2024-11-17 00:05
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- DLP Dynamic Floor Projection Technology for Automotive Exterior Lighting
- 16 PCB welding defects! What are their hazards?
- EEWORLD University ---- PCB Design Video - Learn PADS PCB Design in 1 Day
- 【NUCLEO-L552ZE Review】-3: Arduino vs. Mbed?
- What is the reason why IIC fails when the MSP430FR2311 power supply voltage rises to 3.5V? How to solve it?
- Signal linear transformation problem
- [GD32E231 DIY Contest] Part 4: Summary
- MSP430 microcontroller peripheral crystal oscillator design selection and reference solution
- 【Gravity:AS7341 Review】+ Sensor Color Value Detection
- Schematic to PCB