Four basic skills to master when developing single chip microcomputer

In the application development of single-chip microcomputer, the problems of code utilization efficiency, anti-interference and reliability of single-chip microcomputer are still plagued. Now summarize several basic skills that should be mastered in the development of single-chip microcomputer.

1. How to reduce bugs in the program.

For how to reduce program bugs, the over-range management parameters that should be considered during system operation are as follows. Physical parameters: These parameters are mainly input parameters of the system, which include excitation parameters, operating parameters in acquisition and processing, and result parameters at the end of processing. 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. Application parameters: These application parameters are often expressed as the application conditions of some single-chip microcomputers and functional units. Process parameter: refers to the parameter that changes orderly in the operation of the system.

2. How to improve the efficiency of C language programming code.

It is an inevitable trend of the development and application of single-chip microcomputer to use C language to design single-chip microcomputer. If you are programming in C, it is best to be familiar with the C compiler you are using to achieve maximum efficiency. First test the number of statement lines in the assembly language corresponding to each C language compilation, so that you can clearly know the efficiency. When programming in the future, use the statement with the highest compilation efficiency. Each C compiler will have certain differences, so the compilation efficiency will also be different. The code length and execution time of an excellent embedded system C compiler are only 5-20% longer than the same functional degree written in assembly language. For complex and time-critical projects, 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 is different due to different MCU manufacturers, especially in the operation of some special function modules. Therefore, if you don't understand these features, there will be many problems in debugging, which will lead to lower execution efficiency than assembly language.

3. How to solve the problem of anti-interference of single-chip microcomputer.

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 it can only depend on whether the anti-interference ability of the single-chip microcomputer is strong enough. While improving the anti-jamming capability of the hardware system, software anti-jamming has been paid more and more attention because of its flexible design, saving hardware resources and good reliability. The most common phenomenon of MCU interference is reset; as for the program running away, software traps and watchdogs can actually be used to pull the program back to the reset state; so the most important thing for MCU software anti-interference is to handle the reset state. Generally, the microcontroller will have some flag registers, which can be used to determine the cause of the reset; in addition, you can also bury some flags in the RAM yourself. When each program is reset, different reset reasons can be determined by judging these signs; it is also possible to directly jump to the corresponding program according to different signs. This can make the program run continuously, 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.

When the design of a single-chip microcomputer system is completed, there will be different test items and methods for different single-chip system products, but some must be tested: testing the completeness of the software functions of the single-chip microcomputer; power-on and power-off tests; burn-in tests; ESD and EFT and other tests. Sometimes, we can also simulate the damage that may occur in human use. For example, the contact port of the single-chip microcomputer system is intentionally rubbed with human body or clothing fabric, thereby testing the antistatic ability. Use a high-power electric drill to work close to the single-chip system to test the anti-electromagnetic interference ability. To sum up, the single-chip microcomputer has become an important aspect of the development and application of the computer. Most of the functions that must be realized by analog circuits or digital circuits in the past can now be realized by software methods using a single-chip microcomputer. This control technology in which software replaces hardware is also called micro-control technology, which is a revolution of traditional control technology. In addition, in the process of development and application, we must master the skills and improve the efficiency, so as to facilitate its wider use.

Servo Drives

Servo Drives,Ac Servo Motor,Digital Motor Driver,Brushless Motor Driver

Zhejiang Synmot Electrical Technology Co., Ltd , https://www.synmot-electrical.com

This entry was posted in on