The purpose of learning microcontrollers is to develop embedded systems. To learn microcontrollers well, you must first have an overall understanding. The following is a brief introduction to the development process of microcontroller application systems, as shown in Figure 1-22.
Figure 1-22 Microcontroller System Development Process
(1) Define the task
Analyze and understand the overall requirements of the project, and comprehensively consider factors such as the system's operating environment, reliability requirements, maintainability, and product cost to formulate feasible performance indicators.
(2) Divide software and hardware functions
A microcontroller system consists of both software and hardware. In application systems, some functions can be implemented using either hardware or software. Using hardware can improve the system's real-time performance and reliability; using software can reduce system costs and simplify the hardware structure. Therefore, when considering the overall system, it is essential to comprehensively analyze these factors and rationally determine the ratio of hardware to software tasks.
(3) Determine the microcontroller and other key components to be used
Based on the hardware design task, select a microcontroller and other key components that can meet the system requirements and have a high cost-performance ratio, such as A/D and D/A converters, sensors, amplifiers, etc. These components need to meet the system's requirements in terms of accuracy, speed, and reliability.
(4) Hardware Design
Based on the overall design requirements and the selected microcontroller and key components, the circuit schematic of the application system was designed using software such as Protel.
(5) Software Design
Based on the overall system design and hardware design, the program structure of the software system is determined and functional modules are divided, and then the program design of each module is carried out.
Microcontroller programming languages can be divided into three categories:
Machine language, also known as binary object code, is the only language that CPU hardware can directly recognize (its meaning is determined during CPU design). All operations that a computer wants to perform must ultimately be translated into corresponding machine language for the CPU to recognize and control. Different CPU series have different meanings in their machine language code.
Assembly language: Because machine language must be converted into binary code, it is inconvenient to remember, use, and directly write programs. Therefore, assembly language, which corresponds to machine language, was developed. Programs written in assembly language execute quickly, occupy less storage space, and are highly efficient.
➢ High-level languages: High-level languages have excellent readability, making program writing and operation very convenient. Currently, the most widely used high-level language is C51.
Both assembly language and high-level language must be translated into machine language before they can be recognized by the CPU.
(6) Simulation debugging
After the software and hardware designs are completed, the integration and debugging phase is required. To avoid wasting resources, system simulation can be performed using Keil C51 and Proteus software before generating the actual circuit board, allowing for timely modification of any issues.
(7) System debugging
After completing the system simulation, use drawing software such as Protel to draw the PCB (Printed Circuit Board) layout based on the circuit schematic. Then, send the PCB layout to the relevant manufacturer to produce the circuit board. Once you receive the circuit board, to facilitate component replacement and circuit modification, you can first solder the required chip sockets onto the circuit board and use a programmer to write the program into the microcontroller.
Next, insert the microcontroller and other chips into the corresponding chip sockets, connect the power supply and other input and output devices, and perform system integration testing until successful.
(8) Testing modifications and user trials
After testing and verification that the system meets the requirements, it will be handed over to users for trial use. Modifications and improvements will be made to address any actual problems that arise, and the system development will be completed.
Discussion on Microcontroller Learning Methods
The process of learning microcontrollers should be a gradual, continuous learning and accumulation process, which can be roughly divided into three stages.
Phase 1: Master the essential basic knowledge for developing microcontrollers.
First, a thorough understanding of the fundamental principles of microcontrollers is essential. Although there are many microcontroller manufacturers now, the basic structures and principles of their microcontrollers are quite similar. These include fundamental concepts and principles such as kernel structure, memory allocation, interrupt handling, timers and counters, serial communication, and port multiplexing. In addition, we need to learn analog electronics, digital electronics, C programming, and schematic and PCB (Printed Circuit Board) design. Only with a solid grasp of these concepts can we smoothly perform tasks such as schematic design, PCB layout, program writing, and system integration testing during system development.
The second stage: After mastering the principles and applications of one microcontroller, begin learning about other microcontrollers from different manufacturers, and understand their unique functions and features.
For example, in practical work, if customers require low cost, we can choose Taiwanese chips such as Hotai, Elan, and Winbond; if customers require industrial-grade performance, it is best to choose from European, American, and Japanese microcontrollers such as PIC, NEC, Freescale, and NXP; if power consumption is to be developed, the MSP430 series should have certain advantages; when designing measuring instruments, mixed-signal chips such as C8051 and AduC842 are more practical.
In addition, it's important to accumulate technical knowledge regularly. During project development, organize commonly used interface programs and control algorithms into modules or functions. If similar or related requirements arise in other projects in the future, the original program can be used directly or with minor modifications, which will save a significant amount of development costs.
The third stage: In the actual project development process, we will continuously delve into the application technology of microcontrollers and continuously accumulate professional knowledge in the application industry.
After acquiring a solid foundation in microcontroller applications and becoming familiar with the development methods of several different types of microcontrollers, for various practical application projects, it is often necessary to understand and master the principles and analysis methods related to peripheral circuits, and to comprehensively consider various factors in combination with the actual application background in order to design a microcontroller application system with optimal performance and the most reasonable structure.
Disclaimer: This article is a reprint. If there are any copyright issues, please contact us promptly for deletion (QQ: 2737591964). We apologize for any inconvenience.