1. Program memory
The program written by the designer is stored in the program memory of the microprocessor.
The AT89S52 has a 64KB program memory addressing space, which is used to store user programs, data, tables and other information. The structure of the program memory is shown in Figure 1.
Figure 1 Structure of AT89S52 program memory
2. Data memory
AT89S52 has 256 bytes of on-chip data memory. The address is 00H~FFH. These 256 units are divided into two parts. One is the user data RAM with addresses from 00H to 7FH (a total of 128 bytes). The address unit from 80H to FFH (also 128 bytes) is the special register (SFR) unit. The upper 128 bytes overlap with the special function register, that is, the upper 128 bytes have the same address as the special function register, but are physically separated.
The 32 units from 00H to 1FH are evenly divided into four blocks, each containing eight 8-bit registers, all named R0 to R7, and these registers are called general registers. The registers in these four blocks are all called R0 to R7, and these four groups of general registers can be selected using the 3rd and 4th bits (RS0 and RS1) of PSW. The
20H-2FH units of the internal data memory are bit addressing areas, which can be used as general units with byte addressing, or their bits can be addressed. The bit addressing area addresses are shown in Table 1
Table 1 RAM bit addressing area address table
In the program storage area, a section of the entry address of the interrupt service program is saved for the interrupt service program: one group of special units is 0003H-0032H, each unit has its own purpose, they are divided into six sections, each section is 8 bytes, specially reserved for the interrupt service program, called the interrupt vector area. AT89S52 has a total of 8 interrupt sources and 6 interrupt vectors, their definitions are shown in Table 2 below,
Table 2 Entry address of interrupt service routine
Special function registers refer to a set of registers with special purposes, also known as dedicated registers. In essence, they are some on-chip RAM units with special functions, reflecting the operating status of the microcontroller. Many functions are also defined and controlled by special function registers. The
high 128 (80~FFH) addresses inside the AT89S52 microcontroller are allocated to special function registers. This address space completely overlaps with the high 128-byte address of the data memory in the chip, but the two are completely independent in physical hardware. The addressing method is used to distinguish this completely overlapping address space. When using direct addressing to access this address space, the special function registers are accessed; when using indirect addressing to access this address space, the data memory is accessed.
AT89S52 has 32 special function registers, which are discretely distributed in the 80H~FFH addresses of the internal RAM. These registered functions have been specially specified and the user cannot modify their structure.
5. Several issues to note
(1) Address overlap
All memories in a single-chip microcomputer must be assigned addresses. The addressable address range is 64KB. Data memory and program memory occupy the same address.
The low 4KB addresses of 0000H to 0FFFFH on and off the chip in the program memory completely overlap, but we use pins to distinguish them: when = 0, select the off-chip, when = 1, select the on-chip, so that they are completely distinguished. The 256 unit addresses
of 0000H to 00FFH on and off the chip in the data memory completely overlap. Different instructions are used to distinguish the access to on-chip and off-chip data: MOV instructions access the on-chip data memory, and MOVX instructions access the off-chip data memory.
(2) The distinction between program memory (ROM) and data memory (RAM)
The distinction between program memory (ROM) and data memory (RAM) is strictly distinguished in use. The program memory can only store program instructions and constant tables. The MOVC instruction can only be used to access data in the program memory. The data memory stores data, and the on-chip and off-chip operation instructions are operated by MOV and MOVX respectively.
(3) The area division of the bit address space is
the 128 bits from 20H to 2FH in the on-chip RAM and the bit addresses in the SFR. These bit addressing units and the bit instruction set constitute the bit processor system.
Previous article:Design and implementation of signal generator based on single chip microcomputer
Next article:External pins and functions of AT89S52 microcontroller
- 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
- 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
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Practical tips on HGI MCU HC32L110
- Help
- ODX-based diagnostic application software INTEWORK-OBT
- Share the MSP430F5529 clock UCS programming considerations
- RK3288 Information
- FFT based on C2000 series DSP
- Occupy the posting position, ESP32---WS2812 16*16 dot matrix drawing points, lines and surfaces
- About the pitfalls of ADXL362 accelerometer
- SimpleLink Wi-Fi Devices
- Efficiency Programming of Single Chip Microcomputer Active Buzzer Driver