Design of a multi-loop microcontroller consisting of a single-chip microcomputer and peripheral serial devices

Publisher:幸福家庭Latest update time:2018-02-09 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

    1 Introduction

    Formation charging and discharging is one of the key processes in the battery production process, and its control level is directly related to the quality of the product. The process requires that the formation charger can charge and discharge the battery multiple times according to conditions such as time, voltage or ampere-hours, and has multiple charging and discharging modes such as static electricity, constant current charging, constant voltage (current limiting) charging, and constant current discharging. It is also required to achieve a control accuracy of ≤1%, a detection accuracy of ≤0.5%, and a current and voltage limiting protection accuracy of ≤2%. Conventional production methods mainly use manual operation, which has low control accuracy, high labor intensity, and human factors have a great impact on product quality. Therefore, the introduction of microcomputer program control devices is of great significance to improving the operation process and improving product quality. [1]


    With the development of new single-chip microcomputers with built-in large-capacity FlashROM, various serial ADCs, DACs, and high-density serial E2PROM technologies, it has become possible to develop high-performance, low-cost, and compact battery charge and discharge controllers. According to the needs of small-capacity multi-circuit charger equipment, this paper proposes a design scheme for a multi-circuit microcontroller consisting of an embedded single-chip microcomputer and its peripheral serial devices, which can simultaneously control the operation of four formation chargers and realize automatic static electricity, constant current charging and discharging, constant voltage current limiting charging and other control functions; it uses a Chinese character LCD display, and can set control program parameters through the keyboard. It has the function of multi-stage automatic control according to time and conditions (voltage, current or ampere-hour); it can automatically memorize the state after power failure, and automatically continue the original process after resuming operation; it automatically monitors faults such as current failure, overcurrent, and overvoltage and gives alarms; in addition, through RS485 serial communication and upper computer networking, it can form a two-level centralized monitoring decentralized system. [2-4]

    2. Hardware Design of Controller

    The hardware of the multi-circuit formation charge and discharge controller mainly consists of two parts: the main control module and the process processing module. According to the design requirements, the main control module should have the following functions: (1) a good human-computer interaction interface, including a keyboard and a display; (2) storage of process control parameters; (3) saving of operating status and data during power failure; (4) high reliability and anti-interference; (5) networking with the host computer to form a two-level centralized monitoring or printing and recording system. The process processing module completes the conditioning, isolation and conversion of the input/output signals of the 4-way formation charger. It includes the output of the system's given control quantity, the input of current and voltage sampling values, and the output of the switch quantity. According to the above functional requirements, the hardware structure of the designed controller is shown in Figure 1.

    360 screenshot 20120511140832875.jpg

    The main control module uses the low-power, high-performance single-chip AT89C55 as the main control CPU, with an internal flash memory capacity of 20KB and an internal RAM of 256 bytes, which can meet the needs of more complex control programs, LCD display Chinese character libraries and communication programs without the need to expand external program memory and data memory. The panel of the main control module provides a 2×7 membrane keyboard and a 192×64 dot matrix LCD display , making the on-site operation screen very friendly.

    The large-capacity 24LCXX series serial E2PROM is used to store a large amount of set process control parameters and power-off status data. The interface between 24LCXX and the microcontroller adopts a two-wire serial bus, which is simple and reliable. The microcontroller is the master device and the 24LCXX is the slave device. The master device reads and writes data to the slave device.

    The process equipment interfaces all use serial chips with simple interfaces. There are a maximum of four signal lines between the process equipment and the single-chip microcomputer, which greatly reduces the number of connections. These signal lines are connected to the single-chip microcomputer after optical coupling isolation, which improves the reliability of the system.

    In addition, considering the characteristics of the control system, it belongs to a multi-point communication mode, and the distance is long, and data requires two-way transmission. Therefore, the RS-485 standard interface with convenient connection, good anti-interference performance, low distortion and low cost is adopted to realize data communication with the host computer.

    The hardware design of the microcontroller fully reflects the characteristics of the embedded system, which is compact in structure, simple in peripherals, small in size, easy to carry, and the cost is also greatly reduced.

    3. Data storage management

    In the process of controlling the operation of the four chargers, a large amount of non-volatile data needs to be saved, such as process control parameters and operation control data. The preset parameters of 8 groups of models are saved in the serial E2PROM, and each group contains 12 stages of process control parameters. In the process of controlling the operation of the charger, the system regularly saves the working parameter values ​​of each circuit charger to the E2PROM. When the system suddenly loses power, it can automatically memorize the state and automatically continue the original process after resuming operation.

    However, considering the randomness of power failure, in order to ensure the correctness and integrity of the data, a specific flag is set to ensure the integrity of the written data. That is, before each operation on 24LCXX, first judge this flag. If it is FFH, it means that the data in the basic data area is complete, and its content is written to the backup data area; if it is 00H, it means that the last operation on the basic data area was interrupted and the data is incomplete, then the content of the backup data area is written to the basic data to restore the data state before power failure. After the data operation is completed, the flag is set to FFH to indicate a complete operation on the data. This method of locking the data operation effectively ensures the stable operation of the system.

    4. Controller software design

    4.1 Real-time multi-task structure and task division

    The controller software adopts a real-time multi-task structure, which is divided into two parts: startup management task and operation task. The startup management task includes power-on command processing (auxiliary self-test, clearing memory data, etc.), system initialization and process control parameter modification settings. At the same time, the serial communication interrupt task is a background task, receiving host computer commands and sending status information to the host computer; the operation task is activated after executing the charger start command, including the main control scheduler (foreground task), system timer interrupt, serial communication interrupt task, etc., and is scheduled and run according to different priorities (foreground tasks are interrupted by background tasks). Figure 2 is a schematic diagram of system tasks and scheduling.

    Background task 1 generates an interrupt every 100ms by the system timer T0, forming a basic clock source and providing various software counters for control and communication tasks. The main control scheduler schedules each task according to the timer counting status to control the operation of the 4-way charger. These tasks include: scanning the keyboard once every 1 second, activating the corresponding task according to the command input by the keyboard, such as starting or terminating the process, displaying the setting parameters, etc.; performing routine data acquisition and processing every 1 second, collecting the voltage and current of the 4-way charger respectively, and processing the conversion results accordingly; cyclically displaying the real-time working status parameters of the 4-way charger every 1 second, including the current working stage, working mode, running time, voltage and current values, ampere-hours, etc.; calculating the ampere-hours of the 4-way chargers every 2 seconds; performing closed-loop feedback control PI adjustment every 3 seconds; accumulating the ampere-hours of the 4-way chargers every 1 minute, and backing up the relevant data to the E2PROM. During the operation, the current and voltage signals are checked regularly. In case of abnormality, interruption, overcurrent, overvoltage and other faults, the fault type and the corresponding charger number are displayed in time.

   360 screenshot 20120511140844781.jpg

    Background task 2 is the serial communication interrupt task. Due to the master-slave asynchronous serial communication, the priority of the communication interrupt task is higher than that of the timer interrupt. Communication interrupts include receiving interrupts and sending interrupts, and need to be switched and controlled and processed as needed. Usually, it is in the receiving interrupt allowed state. When receiving the polling message from the host computer, it organizes the sending of the message, sends the message frame to the message buffer, starts the sending interrupt and the sending counter, and sends a byte according to the counter in the subsequent sending interrupt tasks until the frame is sent and the sending interrupt is prohibited. If the host computer data/command message header is received, the receiving buffer is cleared and the next receiving interrupt byte is waited.

    4.2 Modular software design

    The software design of this controller adopts a modular structure to make the program clear and concise. At the same time, each module is relatively independent and can be debugged separately. When the program is expanded, do not change the original structure, just modify the corresponding module. According to the division of system tasks in Figure 2, the program module is mainly composed of the main control program and timer interrupt program module, communication program module, display and keyboard processing module, input and output and control quantity calculation module. The connection between the modules is to use the logic processing function of the single-chip microcomputer, set the flag bit, and control and call it by querying the flag bit.

    Due to space constraints, the working process of each module will not be introduced in detail.

    5. Design of Communication System

    The application object of this article is the plate or closed battery charging and discharging control device of the battery factory. In order to reduce costs, facilitate management and improve system reliability, the control system design can adopt a small distributed control system, that is, a two-layer structure: a distributed multi-loop controller is equipped with an operation station (commonly known as a host computer and a slave computer). Through a low-cost, highly reliable RS-485 real-time communication network, dozens of multi-loop controllers are connected to the PC to realize centralized monitoring and operation of the production process. The communication between the host computer and the slave computer includes data downloading, data uploading, command issuance, etc. The communication system design is as follows:

    (1) The system physical layer protocol adopts the RS-485 standard. In order to maximize the communication rate within the allowable range, the baud rate is a non-standard 3125bps. When the host computer uses software polling to communicate with 20 field controllers one by one, through appropriate software design, the real-time requirements of the charging and discharging process can be basically met.

    (2) According to the link layer protocol reference HDLC, short frame fixed length transmission is adopted, and each frame has 7 valid bytes. The application layer requires the realization of functions such as real-time data upload, historical data upload, control parameter data download and command issuance.

    (3) This system adopts the master-slave mode of master station polling. The master station initiates communication, and there is no network conflict. The master station selects the slave station it requires to communicate with, and each slave station can have different priorities. Compared with the bus-type control network, this method is easy to understand and implement.

    6 Conclusion

    The experiment and actual operation on site show that the multi-circuit formation charge and discharge controller has a good human-machine dialogue window, simple structure, easy operation, flexible parameter setting, and strong adaptability. The system hardware and software equipment works normally, has complete functions, is stable and reliable, and has perfect system self-diagnosis and fault location functions. It also has the characteristics of low cost and small size (80×160×100).

    references

    [1] Jia Yingjiang, Jia Xiangying, A brief discussion on battery charging, 1998, (4): 22-24.

    [2] He Limin, MCS-51 Series Single Chip Microcomputer Application System Design, Beijing University of Aeronautics and Astronautics Press, 1990.

    [3] Li Weizhen, Guo Qiang, Liquid Crystal Display Application Handbook, Publishing House of Electronics Industry, 2002.

    [4] Ran Quan, Zhang Difeng, Implementation of multi-tasking and multi-threading mechanism in single-chip microcomputer system, Single-chip Microcomputer and Embedded System Application, 2003, (6)


Keywords:MCU Reference address:Design of a multi-loop microcontroller consisting of a single-chip microcomputer and peripheral serial devices

Previous article:Functional implementation of ARM program jumping to interrupt service routine
Next article:Application of In-Circuit Emulator in Embedded System Design

Recommended ReadingLatest update time:2024-11-16 22:54

FPGA encryption application based on single chip SRAM technology
In the design of modern electronic systems, programmable logic devices have been widely used due to their excellent performance and flexible and convenient upgrade characteristics. Since large-scale high-density programmable logic devices mostly use SRAM technology, it is required to reconfigure the FPGA device every t
[Microcontroller]
FPGA encryption application based on single chip SRAM technology
Calculator assembly language based on 51 single chip microcomputer
The calculators we talked about before were all based on C language. Next, let’s talk about a simple calculator based on assembly language. hardware design The display is still a digital tube, and the MCU is C51, which supports integer calculation. Simulation diagram: programming YJ EQU 50H ;Result storage YJ1 E
[Microcontroller]
Calculator assembly language based on 51 single chip microcomputer
Implementing AD detection board using PC104 control module and C51 microcontroller
  The control detection board composed of PC104 control module and Cgnal C8051F06x microcontroller can be used in high-end detection equipment. It makes full use of the rich software and hardware resources of PC104 control module and microcontroller and can be used in various detection applications.   In the process
[Test Measurement]
Summary of single chip microcomputer delay method
There are usually two ways to achieve delay: one is hardware delay, which requires the use of timers/counters. This method can improve the CPU's work efficiency and achieve precise delay; the other is software delay, which mainly uses a loop body. 1 Using timers/counters to achieve precise delays Single-chip microco
[Microcontroller]
MSP430 MCU GPIO Programming Tutorial
In this tutorial, we will learn how to program the GPIO of the MSP430 microcontroller. This article is also applicable to MSP430x2xx devices used on Launchpad development boards, such as MSP430G2553, MSP430G2231, etc. Most pins on the MSP430 microcontroller are grouped into up to 8 ports, P1 to P8. Each port is 8 bits
[Microcontroller]
Magical Uses of MCU Internal Reference Voltage
I recently came across the STM32L0 series MCU, which is also powered by dry batteries to give full play to its ultra-low power consumption. I want to obtain the current power of the dry battery pack. The initial design was to find an ADC on the MCU's IO port and use voltage division to allow the MCU to directly collec
[Microcontroller]
Magical Uses of MCU Internal Reference Voltage
Analysis of the usage of ATMEGA16 microcontroller I0 port
1. Use of ATMEGA16 I port: (only one experiment, each section below may have several experimental verifications, you know) 1--(01)--Use of 4*4 matrix push button switch I/O port introduction: Just a picture, because there is nothing much, just the control register (it must be noted here that the functions of the A
[Microcontroller]
Analysis of the usage of ATMEGA16 microcontroller I0 port
Design and simulation of electronic password lock based on STC89C52 single chip microcomputer based on C language
search: IC Inventory Certified Inventory PDF article username: password: Community enterprise Sign Up for Free front
[Microcontroller]
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号