Some people like to modify startup.a51 to satisfy their own hobbies. This is unnecessary and may be wrong. For example, if you want to save some variables during power-off protection, it is a stupid method to modify startup.a51. In fact, you can just use the characteristics of the non-variable area and define a pointer variable to point to the lower part of the stack: 0xff. Why do you still need to modify it? It can be said that you don't need to modify startup.a51 at any time if you understand its characteristics.
Bit
is the address of a bit in the 20H .. 2FH area in the internal data storage space. This appears in byte form after 20H of DATA and can be referenced. In addition, the 8051 addressable SFR, but just tried, only 00H--7FH works, that is, when the data changes, the color turns red, and the subsequent from 80H to--FFH is not a bit addressable area, but a bit addressable special register. If the 11 bit addressable ones are involved, of course there will be a response.
After reset, the content of the program counter PC is 0000H, and the value of each unit of the internal RAM is uncertain. The reset values of each function register are as follows: the reset value of the stack pointer SP is 07H, the reset value of the accumulator ACC and register B is 00H, the reset value of the data pointer DPTR is 0000H, and the reset value of the four ports p0, p1, p2, and p3 is 0FFH. The reset values of other SFRs such as PSW, TCON, TMOD, TL0, TH0, TL1, and TH1 are also 00H.
The wave consists of the lower 128 bytes and the upper 128 bytes (0-7FH). The lower 128 bytes are the on-chip RAM area, and the upper 128 bytes (80-FFH) are the SFR (special function register) bits, which are located in the 20H .. 2FH area of the lower 128 bytes. That is, the 20H .. 2FH area of the data
is
a code address between 0000H .. 0FFFFH.
I use
ORG
TAB:
CODE from 5000H onwards becomes DB
data
is a data memory address between 0 and 127, or a special function register (SFR) address in the range of 128 .. 255 plus. The two are accessed in different ways. In fact, since the reset setting of PSW PSW.3=RS0 and PSW.4=RS1 are both 0, the general working register area is area 0, so the 00--07H part of data corresponds to R0--R7 in the REG column. The latter only represents the lower 128 bytes of internal RAM.
idata
is an idata memory address in the range of 0 to 255.
idata and data overlap in the lower 128 bytes. In some places, only DATA represents 256 bytes of on-chip RAM.
xdata is an xdata memory address in the range of 0 to 65535.
Detailed explanation of the relationship between pointer type and storage area
1. Relationship between storage type and storage area
2. Relationship
For example:
It may be a little difficult to understand and remember when you first learn C51. It doesn't matter. We can immediately see what happens when the corresponding keywords before and after the "*" are used during compilation.
code:
it is compiled into a pointer variable pointing to the internal ram according to the KeilC compilation environment. This is also a bug caused by beginners of C51 who do not understand the keyword definitions of each storage type. Especially when
the default storage area class in the project is large, and tmp[10] is declared as uchar tmp[10], such bugs are very hidden and not easy to find.
xdata area (the function of the xdata keyword before the "*"). The compiled assembly code is as follows. [page]
to the external RAM area. The compiled assembly code is as follows.
". Please follow me to see the compiled assembly code. Someone asked if this is not talking about C51? Why do we need to show the assembly code. To use C51 well, you need to improve
the efficiency of C51 after compilation as much as possible. Looking at the compiled assembly will help you become an expert in producing efficient C51 code as soon as possible. Let's look at the code!
? This is an internal process of KeilC. In KeilC, a pointer variable occupies a maximum of 3 bytes. For pointers that do not declare the pointer to the storage space type,
the system compiles the code and forces a byte of pointer type identification value to be loaded. For specific correspondence, please refer to the C51 User's Guide in KeilC's help.
Previous article:Why is the serial port initialization of C51 microcontroller like this?
Next article:The role of startup.a51 in Keil C
Recommended ReadingLatest update time:2024-11-16 21:01
- Popular Resources
- Popular amplifiers
- Virtualization Technology Practice Guide - High-efficiency and low-cost solutions for small and medium-sized enterprises (Wang Chunhai)
- Detailed explanation of big data technology system: principles, architecture and practice (Dong Xicheng)
- Handbook of Multisensor Data Fusion: Theory and Practice
- Multi-Sensor Data Fusion: An Introduction
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [Hua Diao Experience] 12 Building the Arduino development environment for ESP32C3
- 08. Anlu SparkRoad Domestic FPGA Evaluation [Learning] VGA Display
- Chuanglong Technology Allwinner A40i Development Board Review 3 Installation of Linux SDK and Lessons Learned
- What are the two chips with silkscreen SI4GK and S551J?
- Problems with sensor acquisition circuits
- What are the RF challenges of small cells for 5G networks?
- Is there really no threshold to making cars?
- Why not use plastic rope as wire?
- [MM32 eMiniBoard Review] AD detects thermistor value to achieve serial port temperature printing LED temperature warning
- About ESP32's off-chip RAM configuration. Go to esp-idf official reference