The transplantation of C to MCU (commonly known as single-chip microcomputer) 8051 began in the mid-to-late 1980s. Objectively speaking, there are many difficulties in transplanting C to 8051 MCU. For example:
The non-von Neumann architecture of the 8051 (separate program and data memory spaces), plus the addition of bit-addressable memory space on-chip;
The on-chip data and program memory space is too small and there is a possibility of expanding them off-chip;
On-chip integrated peripherals are registered (i.e. SFR) rather than using the conventional I/O address space;
There are many derivatives of the 8051 chip (more than a hundred), and the C language must be able to operate on each of their hardware resources without exception.
These are all features that the C language based on MPU did not have in the past. After unremitting efforts by Keil/Franklin, Archmeades, IAR, BSO/Tasking and other companies, it finally matured in the 1990s and became a professional MCU high-level language. The shortcomings that have long troubled people in the past, such as "the code generated by high-level languages is too long and the running speed is too slow, so it is not suitable for single-chip microcomputers", have been largely overcome. At present, the code length of C language on 8051 has reached 1.2~1.5 times that of assembly level. Above 4K bytes, the advantages of C language can be more fully utilized. As for the issue of execution speed, as long as there is a good simulator to help find the key code and further optimize it manually, it can be very simple to achieve a very satisfactory level. If we talk about development speed, software quality, rigorous structure, and program robustness, the perfection of C language is by no means comparable to assembly language programming. Today, it is indeed time for MCU developers to pick up the weapon of C language.
The following introduces the advantages of the single-chip C language in combination with 8051:
Even if you don't know the instruction set of the microcontroller, you can still write a perfect microcontroller program;
·You can compile professional programs that conform to the actual hardware without having to understand the specific hardware of the microcontroller;
Data of different functions are overwritten to effectively utilize the limited RAM space on the chip;
·The program is robust: Data corruption is an important factor that causes program abnormality. C language performs many professional data processing to avoid non-asynchronous corruption during operation;
C language provides complex data types (arrays, structures, unions, enumerations, pointers, etc.), which greatly enhances program processing capabilities and flexibility;
Provide storage types such as auto, static, const, and storage types such as data, idata, pdata, xdata, code, etc. specifically for 8051 microcontrollers, and automatically allocate addresses for variables reasonably;
Provide small, compact, large and other compilation modes to adapt to the size of on-chip memory;
The scene protection and recovery of the interrupt service program and the filling of the interrupt vector table are directly related to the microcontroller and are handled by the C compiler;
Provide commonly used standard function libraries for users to use directly;
The header file defines macros, describes complex data types and function prototypes, which is conducive to the transplantation of programs and the development of serialized products supporting single-chip microcomputers;
There is strict syntax checking, and errors are rare, which can be easily and quickly eliminated at the high-level language level;
It can easily accept the services of various utilities: for example, the initialization of on-chip resources is automatically generated by special utilities; for another example, there is a real-time multitasking operating system that can schedule multiple tasks, simplify user programming, and improve operation security, etc.
Previous article:Common methods and countermeasures for cracking single-chip microcomputers
Next article:Have you ever thought about how the microcontroller program runs?
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Let’s talk about the “Three Musketeers” of radar in autonomous driving
- Why software-defined vehicles transform cars from tools into living spaces
- How Lucid is overtaking Tesla with smaller motors
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Wi-Fi 8 specification is on the way: 2.4/5/6GHz triple-band operation
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Vietnam's chip packaging and testing business is growing, and supply-side fragmentation is splitting the market
- Three steps to govern hybrid multicloud environments
- Three steps to govern hybrid multicloud environments
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- (C-Wireless Charging Electric Car) Liaoning Province First Prize_C
- Benefits of Spread Spectrum
- Don’t sell your old phone to buy a new one, learn how to make your own server!
- Can anyone recommend an inexpensive isolation amplifier product, either a chip or a module, with an accuracy of 1% and DC signal sampling?
- Problems with STM32F767 driving Bluetooth module
- Infineon Position2Go Development Kit Review @4. Development
- HFSS Wave Ports and Lumped Ports
- Using the MS-formula library of st 3.1, the scan results do not contain the device name
- What does it mean when the port latch is set to 1? How should I understand this sentence? It would be better if there is a picture to illustrate it.
- Simplifying Equalization Design for USB 3.0 Systems