Abstract: This paper uses the A3967SLB serial port controller launched by Allegro as the hardware core of the stepper motor subdivision drive system, and realizes the 8-subdivision drive of the stepper motor. The serial communication design between the host computer and the stepper motor control system based on the single-chip microcomputer is discussed, and the hardware interface circuit of the single-chip microcomputer serial communication is given.
Keywords: A3967SLB; stepper motor; subdivision drive; serial communication
The stepper motor has high precision, small inertia, and no step error accumulation without losing step. It is particularly suitable for digital control positioning systems. The traditional subdivision drive circuit consists of subdivision ring distributors, amplifiers, and synthesizers. This circuit is complex to apply and has poor flexibility. This paper uses A3967SLB as a stepper motor microcontroller chip to simplify the control implementation of the stepper motor. Since the microcontroller resources are not as rich as PCs, and the human-machine interface is not as friendly as PCs, this paper adopts a master-slave structure, that is, PCs are used for management and microcontrollers are used for execution.
The drive part of the stepper motor is composed of A3967SLB
. A3967SLB is a PWM constant current control micro-step drive two-phase stepper motor dedicated driver produced by Allegro, USA. Its operating voltage can reach 30V, and the drive current can reach 750mA. One A3967SLB can drive a two-phase stepper motor and can achieve 8 subdivision drives. The PWM current control circuit inside the chip can be set to three current decay modes: slow, fast, and mixed by adding a voltage to the PFD. If the voltage at the PFD end is higher than 0.6VDD, the slow decay mode is selected. If it is lower than 0.21VDD, the fast decay mode is selected. The mixed decay mode is between the two. In addition, the A3967SLB can also provide complete protection measures, including transient voltage suppression, overheating protection, current direct current prevention, undervoltage self-locking and other functions.
There is no need to add other interface circuits between the A3967SLB and the microprocessor. The chip uses the Easy Stepper interface, which reduces 8 control lines by 2 (step length and direction). As long as the pulses for controlling the stepper motor are simply input, the built-in converter can realize the control of the stepper motor. The A3967SLB also needs some resistors and capacitors to adjust its working parameters. The entire drive circuit is very simple.
As shown in Figure 1, ms1 and ms2 are the logic input ports for selecting the subdivision resolution of the stepper motor; dir is the port for selecting the direction of the motor; reset is used to reset the initial value of the chip and shield all external outputs; step is the pulse input port; out1a, out1b, out2a, and out2b are two pairs of output ports of the H bridge; enable is the enable terminal; sleep is the sleep mode; sense1 and sense2 are the current detection resistors of the H bridge; ref is the reference voltage; gnd is the logic ground and power ground; rc1 and rc2 are the fixed cutoff time analog inputs of the H bridge. The maximum current limit imax is determined by the sampling resistor rs and the input reference voltage vref of the sampling comparator:
imax=vref/8rs
at89c52 has 8kb flash, 256b internal ram, 32 i/o lines, 3 16-bit timers/counters, a 6-vector two-level interrupt system, a full-duplex serial communication interface, and an oscillator and clock circuit inside the chip. It is very convenient to use. In this system, the microcontroller is mainly used to generate control pulses and communicate serially with the host computer.
Communication circuit
In the simplest RS-232 direct transmission communication system, as long as both the sender and the receiver are ready at the same time, communication can be carried out using only three signal lines: signal transmitter (TXD), signal receiver (RXD) and signal ground (GND); if data communication is carried out in response mode, four signals: request to send (RTS), clear to send (CTS) or data terminal ready (DTR), data device ready (DSR) can be used for hardware handshake. In the AT89C52 single-chip microcomputer system, the serial port lines RXD and TXD are respectively led out from P3.0 and P3.1, and converted into the level of the RS-232 interface standard through a dedicated level conversion chip, so that digital signals can be transmitted between the two through the RS-232 interface. The single-chip microcomputer can communicate data with the host through direct transmission or response handshake, but because the handshake mode occupies other ports and the number of ports of the single-chip microcomputer is limited, the communication between the computer and the single-chip microcomputer often adopts the direct transmission mode. The communication circuit is shown in Figure 2.
Software Design
The design of the software part mainly includes the receiving program of the lower computer according to the MCU, the pulse control program and the serial port sending program of the upper computer. Data communication is carried out between the upper computer and the lower computer. The program of the upper computer is mainly implemented through the windows visual programming vc++.
The lower computer program is mainly responsible for receiving the data sent by the PC and generating control pulses as required. The specific process is: first initialize the serial port to be used, then clear the p2 output port, and then enter the dead loop of the main program to wait for the interrupt to be triggered. Receive a byte of data, ri=1, and then clear ri. When the microcontroller receives the data, the flag position is 1. Store the data in the cache into the control variable for use during control (the specific operation is to send the data frame first and then the start frame). The software control process is shown in Figure 3.
Conclusion
Combined with the stepper motor control system based on A3967SLB introduced above, the serial communication between PC and MCU is realized by using MSCOMM control in VC++ environment. The experimental results show that it is feasible and effective to use this method to realize the precise driving of the stepper motor control system based on A3967SLB by the host computer.
In this system, the rich software and hardware resources and powerful system functions of PC can be used to perform some data processing, display and other tasks; while the slave controller AT89C52 is used for real-time control. In addition, the system is an open structure, which is convenient for system upgrade.
Previous article:Design of bell ringer based on ATmage8
Next article:AVR MCU GCC Programming
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- 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
- TMS320C62x Boot Mode
- GPIO block diagram of C6000 series DSP
- [New version of Zhongke Bluexun AB32VG1 RISC-V development board] - 0: Unboxing post - At this point it surpasses "UNO"
- ADCPro and DXP FAQ
- Prize-winning survey | Keysight Technologies’ entry-level R&D oscilloscope EXR is now online with a surprise!
- [Mill MYB-YT507 development board trial experience] Evaluation summary
- How to build a discrete MCU/CPU circuit
- Live streaming portal is now open | ST's highly flexible, easy-to-use, customizable protocol stack - BlueNRG-LP protocol stack introduction
- Getting Started: How to Quickly Develop MSP430 Projects
- DCDC chip, where exactly is the limit on the output power of an external MOS like this?