If you don’t understand these skills, it’s really difficult to further advance!


In the development process of single chip microcomputer, we are always troubled by the execution efficiency of code, the performance and cost of single-chip devices, so that it is inevitable to think about such problems for a long time. After all, the cost performance, execution efficiency and other factors in the development process are very important factors. In order to let everyone more efficient development, small editor summed up a few skills, to help everyone advance, in the road of excellent developers more and more far!

How to improve the code efficiency of C?

It is an inevitable trend for the development and application of single-chip microcomputer to use C language for programming. If you use C programming, to achieve the highest efficiency, it is best to be familiar with the C compiler used. First test the number of statement lines of the corresponding assembly language after each C language is compiled, so that we can know the efficiency clearly. In the future programming, use the most efficient statement.

The code length and execution time of excellent embedded system c compiler are only 5-20% longer than those written in assembly language.

Although C language is the most common high-level language, because of different MCU manufacturers, their c language compiling system is different, especially in the operation of some special function modules. Therefore, if you do not understand these features, there will be a lot of problems in debugging, and the execution efficiency will be lower than that of assembly language.

How to solve the anti-interference problem of SCM?

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 we can only see whether 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 running away, in fact, you can also use software traps and watchdog to pull the program back to the reset state; therefore, the most important thing of SCM software anti-interference is to deal with the reset state.

General microcontroller will have some flag registers, can be used to determine the cause of reset; in addition, you can also bury some signs in RAM. In each program reset, different reset reasons can be determined by judging these marks, and the corresponding program can be directly jumped according to different marks. In this way, the program can run continuously and the user will not notice that the program has been reset.

How to test the reliability of SCM system?

There are different test items and methods for different single chip microcomputer system products, but some must be tested

The software function of MCU is tested. This is for all single-chip system function test, test whether the software is written correctly and completely.

Power on and power down test. In use, users will inevitably encounter the situation of power on and power off, and can switch on and off the power supply for many times to test the reliability of the single-chip microcomputer system.

Aging test. Test the reliability of single-chip microcomputer system under long-time working condition. If necessary, it can be placed in high temperature, high pressure and strong electromagnetic interference environment test.

ESD and EFT tests. Various interference simulators can be used to test the reliability of SCM system. For example, using static simulator to test the anti-static ESD capability of single-chip microcomputer system, using the burst noise simulator to test the fast pulse anti-interference EFT, etc.

More wonderful, please use wechat to scan the QR code below for free!!!
If you don't understand these skills, it's really difficult to further advance!