A New Stepper Motor Motion Controller Based on Single Chip Microcomputer

Publisher:chinalisaLatest update time:2010-07-27 Source: 微计算机信息 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

CNC technology is a high-tech technology that uses computers to perform digital calculations on various control information in the machining process and automatically controls mechanical actuators through high-performance drive units. Modern mechanical processing industry is gradually developing towards flexibility, integration, and intelligence. Therefore, the new generation of CNC technology must emphasize the characteristics of openness, intelligence, and networking [1]. This paper uses a new microprocessor and high-performance integrated circuit to research and develop an intelligent stepper motor control card.

2. System overall structure design

By analyzing, studying and comparing the key technologies of stepper motor controllers, and integrating the development trend of intelligent, integrated and open motion controller products at home and abroad, the overall structure of the stepper motor motion controller we proposed is shown in Figure 1.


Figure 1 System overall structure

3 System Hardware Circuit Design

3.1 Pulse frequency division circuit design

The main control object of this system is the stepper motor. The stepper motor is an actuator that converts electrical pulses into angular displacement. Therefore, generating stepper motor drive pulses that meet the system requirements is the key to the entire system design. The pulse frequency division circuit of this system is shown in Figure 2. The entire circuit uses 3 8254s to generate drive pulse signals for the X, Y, and Z axes. Since the circuits for the Y and Z axes are the same as those for the X axis, the figure only shows the circuit principle of the X axis pulse number output.

Inte18254 is a programmable timer/counter. It contains 3 independent channels. Each channel is a 16-bit counter with the same function. The working mode and counting length of each counter are selected by software programming. 8254 is an improved version of 8253. Its operation mode and pins are exactly the same as 8253. The counting frequency of 8253 is 2.6MHz, while the counting frequency of 8254 is higher, reaching 6MHz. This system selects 8254 as the main control chip of the pulse frequency division circuit.


Figure 2 Pulse frequency division circuit diagram

3.2 RS-232 communication interface circuit design

In the communication of single-chip microcomputer system, RS-232 and RS-485 standard buses are the most mature. In order to make the application scope of motion controller wider, in conjunction with the existing interface of PC, we choose RS-232 standard bus to realize the communication between controller and PC, and its interface circuit is shown in Figure 3. In Figure 3, MAX232 is selected as the communication interface chip of the system. MAX232 is a low-power, single-power dual RS-232 transmitter/receiver produced by MAXIM, which is suitable for various EIA-232E and V.28/V.24 communication interfaces. The MAX232 chip can convert the input +5V power supply into the ±10V voltage required for RS-232 output level, so the serial communication system using this chip interface only needs a single +5V power supply.


Figure 3 Communication interface circuit

MAX232 requires four electrolytic capacitors C1, C2, C3, and C4 for internal power conversion. Their values ​​are all 0.1μF/25V. C44 is a 0.1μF decoupling capacitor. MAX232's pins T1IN, T2IN, R1OUT, and R2OUT are TTL/CMOS level pins.

Pins T1OUT, T2OUT, R1IN, and R2IN are pins connected to RS-232C levels. Therefore, the TTL/CMOS level T1IN and T2IN pins should be connected to the serial transmission pin TXD of MCS-51; R1OUT and R2OUT should be connected to the serial reception pin RxD of MCS-51. Correspondingly, the RS-232C level T1OUT and T2OUT should be connected to the receiving end RD of the PC; R1IN and R2IN should be connected to the transmitting end of the PC.

3.3 D/A conversion and V/I conversion circuit design

This motion controller needs to control the speed of the electric spindle, and the control of the electric spindle is achieved through its driver. The electric spindle driver determines the speed of the spindle according to the input voltage or current. Therefore, the system needs to output a voltage of 0 to 5V or a current of 0 to 20mA. The digital quantity processed by the system must be converted into an analog output through D/A conversion. The D/A conversion of this controller is mainly realized by the DAC0832 chip. DAC0832 is an 8-bit microprocessor-compatible digital/analog converter chip, which is a type of DAC0830 series. DAC0832 is easy to interface with a microcomputer and can make full use of the control capability of the microprocessor to realize the control of D/A conversion. Therefore, it has been widely used in practice.

Different electric spindle drivers have different requirements for input signals. Some require a voltage signal of 0 to 5V, and some require a current signal of 0 to 20mV. Therefore, we also designed a V/I conversion circuit to enable the system to have the output of current signals, thereby enhancing the adaptability of the system.

3.4 Switch signal input circuit design

During the movement of the stepper motor, mechanical switches and photoelectric switches are often used to form a switch signal input circuit. The closing or opening of the switch reflects the working condition of the stepper motor in the form of a level. This includes X, Y, and Z axis limit; tool setting during processing, X, Y, and Z axis motor zero return operation, etc. [2-3].

Due to the mechanical design of the switch, there is mechanical jitter when the contacts are closed or opened, which will cause the output signal waveform to oscillate. If the signal is input into the counter of the microcontroller, it will cause an erroneous count and lead to chaotic system control. The input interference of the switch quantity is an objective problem in system design. Therefore, after obtaining the switch signal, we must process the switch signal and make it a digital signal that can be recognized by the microcontroller before making a corresponding response. The system provides a total of 12 switch signal interfaces, and the limit switch signal processing is shown in Figure 4.


Figure 4 Schematic diagram of limit switch signal processing circuit

Before the switch signal is input into the CPU, it is first filtered by a capacitor to suppress the high-frequency components in the signal. TPL optocoupler isolation realizes the level conversion between the photoelectric switch, limit switch signal and controller, and realizes the isolation between two different circuits, ensuring that the controller circuit is not interfered by the switch signal circuit.

3.5 Hardware Anti-interference Technology

In order to overcome various possible interferences and ensure the reliable operation of the system, existing anti-interference technologies take the following measures in hardware [4]:

① Suppress power supply interference. Conducted interference is usually introduced into the system from the AC power supply. In order to suppress this interference, the system usually connects a low-pass LC filter in series at the AC input end. This method has achieved obvious results in practice, but in order to suppress the impact of power surge voltage, the system must also install varistors between the power lines and between the power lines and the ground.

② Suppress transmission line interference. For lines with longer transmission distances in the system, shielded cables are usually used to connect the various parts of the system to achieve the purpose of anti-interference. In some systems with harsh application environments, in order to further suppress interference, photoelectric isolation can be used to separate the system control part from the I/O port part, and dual power supply can be used.

③Try to minimize the impact of interference. Common practices include: 1) Add a hardware watchdog circuit. 2) Add a voltage monitoring circuit. 3) Select a microcontroller series with strong anti-interference capabilities. 4) Use the internal program memory and internal data memory of the microcontroller as much as possible instead of using an external bus to connect these devices. 5) Coordinate the level matching of different types of ICs in the circuit. 6) When the data bus and the control bus form a board-to-board connection, a bus driver should be added.

4 System Software Design

The main program of the system consists of a message loop and an initialization program, and its flow is shown in Figure 5. In the main program of the system, the function of the initialization program is to complete the setting of each special function register of the microcontroller, the initialization of each data area, the setting of external hardware devices, etc. after the system is reset; the system message loop is used to realize the judgment of the legitimacy of the message and the call of the message processing function module.


Figure 5 System main program flow chart

In order to be able to judge the legitimacy of the message, we define a corresponding legitimacy judgment flag for each message in the message group. If the legitimacy judgment flag corresponding to a message is "1", it means that the message is a legal message, and the system should call the corresponding message processing function module to process the message; if it is "0", it means that the message is an illegal message and the system should ignore it. In order to implement the "watchdog" function, we also added a dog feeding output operation to the message loop. It is worth noting that in the serial communication processing module of the system, the flag bits in the message sequence are set according to the received data to determine whether it is automatic processing, manual processing, or parameter setting, so as to ensure that the main program can correctly implement the call of each processing module.

5 Innovations of this paper

This system uses MCS51 series single chip microcomputer to process data and control the motion state, and the 8254 programmable timer/counter realizes the frequency division output of pulses, ensuring the real-time requirements of motion control. In order to enable the motion controller to work reliably in harsh environments, we use X5045 integrated chip as the main component to form a low-cost, high-reliability anti-interference circuit to realize automatic protection of the stepper motor motion control card. Since the system was put into use, it has generated direct economic benefits of more than 500,000 yuan.

Reference address:A New Stepper Motor Motion Controller Based on Single Chip Microcomputer

Previous article:Design of wireless transmission system for well site instrument parameters based on single chip microcomputer
Next article:Stepper Motor Control System Based on PIC16F873 Single Chip Microcomputer

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号