10 Problems Encountered in MCU Programming

Publisher:科技奇思Latest update time:2017-11-13 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. What are the advantages and disadvantages of C language and assembly language in microcontroller programming? Answer: Assembly language is a symbolic language that uses text mnemonics to represent machine instructions. It is the language closest to machine code. Its main advantages are that it takes up less resources and has high program execution efficiency. However, different CPUs may have different assembly languages, so it is not easy to transplant.
C language is a structured high-level language. Its advantages are good readability and easy transplantation, and it is a commonly used computer language. The disadvantage is that it takes up more resources and its execution efficiency is not as high as assembly language.
For the 8-bit MCU with RISC architecture that is currently widely used, its internal ROM, RAM, STACK and other resources are limited. If it is written in C language, a C language instruction will become many machine codes after compilation, which may easily cause problems such as insufficient ROM space and stack overflow. Moreover, some microcontroller manufacturers may not be able to provide C compilers. In assembly language, one instruction corresponds to one machine code, and it is clear what action is performed at each step. In addition, the program size and stack call situation are easy to control, and debugging is also more convenient. Therefore, in the development of single-chip microcomputers, we still recommend the use of assembly language.


2. C or assembly language can be used for single-chip microcomputers, can C++ be used? Answer: In single-chip microcomputer programming, assembly and C are mainly used, and C++ is not used.

3. Do you have to know C to do single-chip microcomputer programming? Answer: Assembly language is a symbolic language that uses text mnemonics to represent machine instructions. It is the language closest to machine code. Its main advantages are that it takes up less resources and has high program execution efficiency. However, different CPUs may have different assembly languages, so it is not easy to transplant.
For the 8-bit MCU with RISC architecture that is currently widely used, its internal ROM, RAM, STACK and other resources are limited. If it is written in C language, a C language instruction will become many machine codes after compilation, which is easy to cause problems such as insufficient ROM space and stack overflow. Moreover, some single-chip microcomputer manufacturers may not be able to provide C compilers. In assembly language, one instruction corresponds to one machine code, and it is clear what action is performed at each step. In addition, the program size and stack call situation are easy to control, and debugging is also more convenient. Therefore, in the development of single-chip microcomputers with fewer resources, we still recommend the use of assembly language.
C language is a compiled programming language that takes into account the characteristics of multiple high-level languages ​​and has the functions of assembly language. C language has rich library functions, fast computing speed, high compilation efficiency, good portability, and can directly control the system hardware. C language is a structured programming language that supports the top-down structured programming technology widely used in current programming. In addition, C language programs have a complete module program structure, which provides a strong guarantee for the use of modular programming methods in software development. Therefore, using C language for programming has become a mainstream in software development. Using C language to write target system software will greatly shorten the development cycle, and
significantly increase the readability of the software, making it easier to improve and expand, thereby developing a larger scale and more complete system.
In summary, using C language for single-chip microcomputer programming is an inevitable trend in single-chip microcomputer development and application. Therefore, as a single-chip microcomputer developer with comprehensive technology and involved in large-scale software system development, it is best to master basic C language programming.

4. When developing a complex project with a short development time, is it better to use C or assembly? Answer: For complex projects with a short 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, different MCU manufacturers have different C language compiler systems, especially in the operation of some special function modules. If you don't understand these features, it will be troublesome to debug, and in the end it may not be as fast as using assembly.

5. In teaching, I need to use 8088 and 196 chip microcontroller programming. Where can I find books or materials on this subject?
A: Regarding textbooks in this area, a commonly used textbook in college is "IBM-PC Assembly Language Programming" published by Tsinghua University Press. It can be found online and in bookstores. In addition, many other textbooks can be searched online, such as "Microcomputer Principles and Assembly Language Tutorial" (edited by Yang Yanshuang, Zhang Xiaodong, etc.) and
"16/32-bit Microcomputer Principles, Assembly Language and Interface Technology" (authors: Zhong Xiaojie and Chen Tao, published by Machinery Industry Press), etc., which can be found in larger science and technology bookstores or ordered directly online.

6. Should beginners learn C or assembly first? A: For beginners of single-chip microcomputers, they should start with assembly. Because assembly language is the language closest to machine code, it can deepen beginners' understanding of the various functional modules of single-chip microcomputers, thus laying a solid foundation.

7. I am a third-year student of electronic science and technology at Wuhan University. I have learned electronic circuits, digital logic, assembly and interface, and C language, but I always feel confused and feel like I don't know anything. What should I do?
Answer: The university process is a theoretical process, and there are relatively few opportunities for practice, which often leads to a disconnect between theory and practice. This is a common problem in the domestic university education system, but students must not aim too high. Generally, you will start to get in touch with some professional courses from the third year of college. Electronic-related majors will offer related single-chip microcomputer application courses and simple experimental projects. Therefore, you must fully grasp the opportunities of experimental classes and practice more on the actual machine operation. You can usually read more related electronic technology magazine websites to see other people's development experience, hardware design solutions and other people's software design experience. If possible, you can also participate in some electronic design competitions. Taking this opportunity, 2-3 people will work together to make a complete system, which will be more helpful. When you reach the fourth year graduation design stage, you can also choose related topics to do some actual cases to gain experience. There is a process of accumulating experience in everything you do, step by step.

8. As a student, how can I learn single-chip microcomputer programming well? Answer: The most important thing to learn single-chip microcomputer programming well is practice, and gain experience in practice. For students in school, there are indeed fewer opportunities for practice, but if there is a chance, you can choose related topics for graduation internships, so that you can get in touch with actual projects. And if the principle of single-chip microcomputer is a main course, I believe the school will arrange more opportunities for practice on the computer. If you have the ability, you can find some related part-time jobs to do, which will be more helpful. And the development and application of single-chip microcomputers requires the combination of software and hardware, so you can't just be satisfied with how
perfect . You should also pay attention to the accumulation of hardware knowledge, visit electronic forums and websites more often, and buy some related magazines. If possible, you can go to the electronic market to buy some small parts and build a small system to make it work.
HOTLEK's single-chip microcomputer is an 8-bit single-chip microcomputer with RISC structure. It can be widely used in household appliances, security systems, handheld games, etc. Generally speaking, it can be divided into I/O type single-chip microcomputer, LCD type single-chip microcomputer, A/D type single-chip microcomputer, A/D with LCD type single-chip microcomputer, etc.

9. How can you become a master of single-chip microcomputer programming? Answer: To become a master of single-chip microcomputer, you should practice more, pay attention to the development trend of single-chip microcomputers; often visit some related websites, where you can find a lot of useful information.

10. Are women suitable for the MCU software programming industry? Answer: It depends on your interest and your patience for software programming. Both men and women are suitable for this industry.

Keywords:MCU Reference address:10 Problems Encountered in MCU Programming

Previous article:Three steps to learn MCU programming design
Next article:The eight most important steps to learn microcontrollers

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号