loading

Some basic skills that should be known in the development of MCU

by:A-TECH      2021-03-27
The meaning of the single-chip microcomputer is a kind of integrated circuit chip, and then adopts the super large-scale integrated circuit technology to integrate the central processing unit with data processing capability CPU random memory RAM, read-only memory ROM, various I/O ports and interrupt systems, timers /Timer and other functions are integrated on a silicon chip to form a small and complete microcomputer system called a single-chip microcomputer, which is widely used in industry and other fields. The development of single-chip microcomputer is very fast, from the 4-bit and 8-bit single-chip microcomputers in the 1980s to the current 32-bit 300M high-speed single-chip microcomputer. Microcontroller development skills Nowadays, in the development and application of single-chip microcomputers, problems such as the efficiency of code use, the anti-interference and reliability of the single-chip microcomputer still plague engineers. In order to help engineers solve the problem of MCU design, 'Electronic Engineering Special' website specially invited Mr. Deng Hongjie, Director of Engineering Department of Holtek Hong Kong Branch, as the guest of 'SCM Application Programming SkillsBased on the discussion in the forum, several basic skills that should be mastered in the development of single-chip microcomputer are summarized. 1. How to improve the efficiency of C language programming code? It is the inevitable trend of MCU development and application to use C language to design the PCB proofing of the MCU program. It is worth noting that: 'If you want to achieve the highest efficiency when using C programming, it is best to be familiar with the C compiler you are using. First test the number of statements in the assembly language that corresponds to each C language compilation. Know the efficiency clearly. When programming in the future, use the most efficient statement.' Each C compiler will have a certain difference, so the compilation efficiency will also be different. Excellent embedded system C compiler code length And the execution time is only 5-20% longer than the same function level written in assembly language. 'For complex and time-critical projects, the C language can be used, but the premise is that you are very familiar with the C language and C compiler of the MCU system, and pay special attention to the data types and algorithms that the C compiler system can support. Although C language is the most common high-level language, the C language compilation system of different MCU manufacturers is different, especially in the operation of some special function modules. So if you don’t understand these features, then There will be a lot of problems when debugging, but the execution efficiency is lower than that of assembly language.' Two. How to reduce bugs in the program. Some suggestions are given on how to reduce bugs in the program, that is, the over-range management parameters that should be considered during system operation. There are: physical parameters. These parameters are mainly the input parameters of the system, which include excitation parameters, operating parameters in acquisition and processing, and result parameters at the end of processing. Set these boundaries reasonably, and treat all parameters beyond the boundaries as abnormal excitations or abnormal responses for error handling. Resource parameters. These parameters are mainly the resources of circuits, devices, and functional units in the system, such as memory capacity, storage unit length, and stacking depth. In programming, resource parameters are not allowed to be used beyond the scope. Application parameters. These application parameters are often expressed as the application conditions of some single-chip microcomputers and functional units. Application parameter limits such as E2PROM erasing and writing times and data storage time. Process parameters. Refers to the orderly changing parameters in the operation of the system. 3. How to solve the anti-interference problem of the single-chip microcomputer: Point out that the most effective way to prevent interference is to remove the interference source and cut off the interference path, but it is often difficult to do so, so we can only see if the anti-interference ability of the single-chip microcomputer is strong enough. The most common phenomenon of MCU interference is reset; as for the program runaway, in fact, software traps and watchdogs can also be used to pull the program back to the reset state; therefore, the most important thing for MCU software anti-interference is to handle the reset state. Generally, single-chip microcomputers will have some flag registers, which can be used to determine the reason for reset; in addition, you can also bury some flags in the AM yourself. Each time the program is reset, different reset reasons can be judged by judging these signs; you can also jump to the corresponding program directly according to different signs. This can make the program run continuity, and the user will not notice that the program has been reset when using it. 4. How to test the reliability of the single-chip microcomputer system Some netizens want to know what methods are used to test the reliability of the single-chip microcomputer system. They feel: 'When a single-chip microcomputer system is designed, there will be different test items and methods for different single-chip microcomputer system products. But there are some things that must be tested: testing the completeness of the software functions of the single-chip microcomputer. This is a test for all the functions of the single-chip microcomputer system to test whether the software is written correctly and completely. Power-on and power-off testing. In use, users will inevitably encounter In the case of power and power failure, you can switch the power supply many times to test the reliability of the single-chip system. Aging test. Test the reliability of the single-chip system under long-term working conditions. If necessary, it can be placed in high temperature, high pressure and strong electromagnetic interference. Environmental testing. ESD and EFT testing. Various interference simulators can be used to test the reliability of the single-chip microcomputer system. For example, the electrostatic simulator is used to test the antistatic ESD ability of the single-chip system; the surge noise simulator is used for fast pulse immunity Interference EFT test and so on.
Custom message
Chat Online 编辑模式下无法使用
Chat Online inputting...
Please hold on and we will get back to you soon