Beginners always have this question. After downloading the program from the computer to the development board, where does the program go? In C51, where are users or applications, system programs and data stored?
From the physical structure, the 51 microcontroller can be divided into on-chip, off-chip program memory, and on-chip and off-chip data memory.
Functionally, the 51 microcontroller has program memory, on-chip data memory, special function registers, bit address space, and off-chip data memory.
program memory
The program memory of the 51 microcontroller is used to store codes and some fixed table constants.
The addressable program memory space is 64KB.
From a physical point of view, the 51 microcontroller can be divided into: on-chip and off-chip program memory. As an addressing space, the addressing rule is: first on-chip, then off-chip, on-chip and off-chip are continuous without overlap.
As shown in the figure: 51 microcontroller program memory addressing diagram.
How does the microcontroller execute instructions?
As shown in the figure:
Regardless of the on-chip program memory or the off-chip program memory, their addresses are shared. If there is 4K ROM on-chip, the address is 0x0000-0x0FFF, and 0x1000-0xFFFF is the address space of the external ROM. Whether this part of 0x0000-0x0FFF of the external ROM is used depends on the level value of the EA pin of the microcontroller. When EA=1, this part of the internal ROM is used, and this part of the external ROM is wasted; when EA=0, this part of the external ROM is used, and the internal ROM is wasted and unused. To read data from the CODE segment, you need to use the assembled MOVC instruction. The microcontroller will automatically determine from which memory the data is to be fetched based on the MOVC instruction, EA status, and the address value to be read.
The program address space can generally be arranged and used according to user needs, but for the entry address of a special program executed by the CPU, the user must store the corresponding program in accordance with regulations.
The special program entrance address is as shown in the figure:
data storage
The internal and external data memories of the 51 microcontroller are two independent address spaces and should be addressed separately.
On-chip data memory address space "00H-FFH", RAM address space "00H-7FH" special function register SFR address space "80H-FFH"
off-chip data memory address space "0000H-FFFFH"
as shown in the figure:
In order to make reasonable use of the storage space of the on-chip data memory, the lower 128 bytes of RAM are divided into different functional areas.
As shown in the picture:
Bit addressing area, address space 20H-2FH, 16 units, 128 bits in total.
Data buffer, address space 30H-7FH, 80 units in total.
Special function registers
Special function registers (SFR, Special Function Registers) are also called special-purpose registers. They are mainly used for management, control, on-chip logic components, parallel I/O ports, serial I/O ports, timers/counters, interrupt systems, etc. Functional modules work.
Summary: Data memory is divided into two parts: internal data memory (IDATA/RAM) and external data memory (XDATA), but these two memories do not share the address space like code memory. The general 8051 chip has only 128B of internal RAM, from 0x00-0x7F, and from 0x80-0xFF is the SFR area (the CPU working register and various peripheral registers are here). For 8052, the internal RAM is 256B, so 0x80-0xFF is the higher 128B of RAM in use. But isn’t this part exclusive to SFR? It is dedicated to SFR, but note that SFR can only be accessed using "direct addressing mode" (implemented using specific assembly instructions). This is the difference. Only addresses accessed via direct addressing are SFRs, otherwise it's ordinary RAM. As for the externally expanded RAM (XDATA), the address is also from 0x0000-0xFFFF, and the 0x0000 here is different from the 0x00 of the internal RAM. They are two completely independent spaces. Their access methods are also different. MCS-51 uses the MOVX instruction to read and write the XDATA area. Moreover, accessing the XDATA area requires the assistance of the DPTR register. Because only DPTR can hold the sixteen-digit XDATA address. refer to:
special function register
Special function registers (SFR, Special Function Registers), also known as special-purpose registers, are mainly used for management, control, on-chip logic components, parallel I/O ports, serial I/O ports, timers/counters, interrupt systems and other functional modules Work.
In the 51 microcontroller, the special registers and on-chip RAM are uniformly addressed and used as direct addressing.
The 51 microcontroller has 18 special registers, 3 of which are double-byte registers, occupying 21 bytes.
In the address space 80H-FFH of the SFR block, only 21 bytes are discretely distributed in the 128-byte range as special function registers. The remaining bytes are undefined, but users cannot perform "read and write operations" on these bytes. "
The following figure is a list of the names, indicators, and addresses of special function registers.
Previous article:Perpetual calendar clock simulation design based on 51 microcontroller
Next article:51 microcontroller project template creation method
- 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
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
- Let’s talk about the “Three Musketeers” of radar in autonomous driving
- Why software-defined vehicles transform cars from tools into living spaces
- EEWORLD University----Live Replay: Microchip Security Series 21 - Secure Boot and Message Authentication for CAN FD in ADAS and IVI Systems Using TA100-VAO
- FAQ: September 6th TTI&TE "The development and latest application of sensors in industrial motors" live broadcast room Q&A
- 【RT-Thread Software Package Application Works】Photo Album
- Summary of Spectrum Analysis Algorithms
- What is an adder? What is an inverting adder?
- ±1% Tolerance 47kΩ Linear Thermistor in 0402 Package Option
- [Repost] Unpacking a hand warmer and power bank bought on a certain website for 6 yuan
- Based on ST FOC5.3 self-made IHM08 V3 board: non-sensing/sensing Hall/sensing encoder/torque mode and other reference programs/circuits...
- 【AT32WB415 Review】02 Clock Configuration + LED Operation
- Reading Notes of the Good Book "Electronic Engineer Self-Study Handbook" 01-Receiving & Title Page