4972 views|6 replies

62

Posts

0

Resources
The OP
 

Several basic skills that should be mastered in single chip microcomputer development [Copy link]

In the development of single-chip microcomputer applications, engineers are still troubled by code efficiency, single-chip microcomputer anti-interference and reliability. In order to help engineers solve the problems in single-chip microcomputer design, the "Electronic Engineering Album" website specially invited Mr. Deng Hongjie, Director of the Engineering Department of Holtek Hong Kong Branch, to be the guest of the special discussion on "Single-chip Microcomputer Application Programming Skills" to exchange single-chip microcomputer design and development experience with the majority of design engineers. Now, based on the discussion in the forum,
several basic skills that should be mastered in single-chip microcomputer development are summarized.


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


Deng Hongjie pointed out that using C language for MCU programming is an inevitable trend in MCU development and application. He emphasized: "If you want to achieve the highest efficiency when programming in C, it is best to be familiar with the C compiler you are using. First test the number of assembly language statements corresponding to each C language compilation, so that you can clearly know the efficiency. When programming in the future, use the statements with the highest compilation efficiency."


He pointed out that each C compiler has some 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 level written in assembly language. He said: "For complex projects with tight development time, you can use C language, 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 compiler systems of different MCU manufacturers are different, especially in the operation of some special function modules. So if you don't understand these features, there will be many problems in debugging, which will lead to lower execution efficiency than assembly language."


2. How to reduce bugs in the program?


Deng Hongjie gave some suggestions on how to reduce program bugs. He pointed out that the out-of-range management parameters that should be considered in system operation are:


1. Physical parameters. These parameters are mainly the input parameters of the system, including excitation parameters, operating parameters in the acquisition process, and result parameters after the process. Reasonable boundaries should be set, and parameters that exceed the boundaries should be treated as abnormal excitation or abnormal response and error handling should be performed.


2. Resource parameters. These parameters are mainly the resources of the circuits, devices, and functional units in the system, such as memory capacity, storage unit length, and stack depth. In programming, resource parameters are not allowed to be used beyond the scope.


3. Application parameters. These application parameters are often expressed as the application conditions of some single-chip microcomputers and functional units, such as the number of erase and write times and data storage time of E2PROM and other application parameter limits.


4. Process parameters: Refers to the parameters that change in an orderly manner during the operation of the system.


3. How to solve the anti-interference problem of MCU


Deng Hongjie pointed out: 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 whether the anti-interference ability of the microcontroller is strong enough. The most common phenomenon of microcontroller interference is reset; as for the program running away, in fact, the software trap and watchdog can also be used to pull the program back to the reset state; so the most important thing for the microcontroller software anti-interference is to handle the reset state. Generally, the microcontroller will have some flag registers that can be used to determine the reset reason; in addition, you can also bury some flags in the RAM yourself. Every time the program is reset, by judging these flags, different reset reasons can be determined; you can also jump directly to the corresponding program according to different flags. 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 MCU system


Some readers want to know what methods are used to test the reliability of the MCU system. Deng Hongjie pointed out: "When a MCU system is designed, there will be different test items and methods for different MCU system products, but there are some that must be tested:


1. Test the completeness of the MCU software functions. This is a test of all MCU system functions to test whether the software is written correctly and completely.


2. Power-on and power-off test. During use, users will inevitably encounter power-on and power-off situations. The power supply can be turned on and off multiple times to test the reliability of the single-chip microcomputer system.


3. Aging test. Test the reliability of the MCU system under long-term operation. If necessary, it can be tested in high temperature, high voltage and strong electromagnetic interference environment.


4. ESD and EFT tests. Various interference simulators can be used to test the reliability of the MCU system. For example, an electrostatic simulator is used to test the anti-static ESD capability of the MCU system; a surge noise simulator is used to perform fast pulse anti-interference EFT tests, etc.

This post is from MCU

Latest reply

Learn from it. Thanks.  Details Published on 2007-11-12 08:44
 

76

Posts

0

Resources
2
 
Good, I learned a lot. Thank you
This post is from MCU
 
 

1379

Posts

0

Resources
3
 
Is there a quick way to find the error after compiling error using microcontroller?
This post is from MCU
 
 
 

33

Posts

0

Resources
4
 
Not bad... Thumbs up...
This post is from MCU
 
 
 

136

Posts

0

Resources
5
 
Study~
This post is from MCU
 
Personal signature喜欢单片机的请加群48811593(500人超级群)
 
 

5

Posts

0

Resources
6
 
Thank you for sharing
This post is from MCU
 
 
 

96

Posts

0

Resources
7
 
Learn from it. Thanks.
This post is from MCU
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list