References:
① Keil > Help
② "STC MCU Principles and Applications - Analysis and Design from Devices, Assembly, C to Operating Systems" by He Bin
③MCS-51 Series Microcontrollers and Their Applications (6th Edition) by Sun Yucai and Sun Huafang
The 8051 microcontroller architecture mainly includes:
CPU (computing unit, controller)
Memory (internal RAM, extended RAM, Flash)
Special Function Registers
Others: peripherals, clock system, etc.
Internal structure of the classic 8051 microcontroller
8051 memory structure and address space
1. CPU (Calculator, Controller)
The arithmetic unit and the controller make up the 8051 central processing unit (CPU).
1. Calculator
The arithmetic unit of the microcontroller mainly includes 8-bit arithmetic/logic operation components, accumulator A, register B, program status register, etc. Its function is to realize data arithmetic/logic operations (data processing) and data transmission and other operations.
1) Arithmetic/Logic Unit ALU
The core component of the arithmetic unit in the 8051 CPU is the arithmetic and logic unit (ALU), which is 8 bits wide. Its main function is to implement 8-bit addition, subtraction, multiplication and division operations, "and", "or", "exclusive or" logic operations, including bit operations and basic operations such as loop, clear "0", set "1", add "1", subtract "1", etc.
2) Accumulator ACC
The accumulator (ACC) is a commonly used special register. The instruction system uses A as the mnemonic of the accumulator. It is often used to store operands and results of arithmetic or logical operations.
3) Register B
Register B needs to be used together with ACC in multiplication and division operations. In other cases, register B can also be used as a general temporary register.
4) Program status word register PSW
When the CPU performs arithmetic or logical operations on the Program Status Word (PSW), the corresponding PSW status bits will change.
2. Controller
1) Program Counter PC
The Program Counter (PC) is used to store the address of the next instruction to be read from the program memory. It continuously reads instruction codes from the program memory, so that the computer can automatically and continuously execute instructions and run programs. The change of the content (address code) in the PC determines the direction of program operation.
The width of the program counter is 16 bits, which determines the addressable range of the program memory of the microcontroller. That is, the maximum capacity of the addressable program memory is 64KB.
The program counter cannot always increment the program address register because machine instructions can be divided into two situations: sequential execution and jump execution.
2) Command channel
a. Instruction fetch unit
The instruction is fetched according to the address of the program memory pointed to by the PC. The machine instructions of 8051 are 8, 16 or 24 bits.
b. Decoding unit
According to the opcode part of the instruction, it is converted into a series of logic control sequences, which will directly control the computing units within the CPU.
c. Execution instruction unit
According to the logical behavior generated by the logic control sequence (microinstructions), the arithmetic unit is controlled to complete the operation behavior required by the instructions.
3) Dual data pointer DPTR
The dual data pointer (DPTR) is a 16-bit dedicated register consisting of DPL and DPH. Its main function is to address the 16-bit address register of the external data memory, and can also address fixed data stored in the 64KB program memory.
4) Stack Pointer SP
The Stack Pointer SP is an 8-bit special register that indicates the location of the top of the stack in the internal RAM block.
2. Memory (internal RAM, extended RAM, Flash)
The 8051 architecture microcontroller memory mainly includes: internal RAM, extended RAM, special function registers and program memory Flash.
1. Internal RAM
The internal RAM supports a maximum of 256 bytes of storage space; data can be read very quickly because it can be directly accessed through an 8-bit address;
The lower 128 bytes can be directly addressed (data) or indirectly addressed (idata); the space from 20H to 2FH can be addressed by bit;
The upper 128 bytes can only be addressed indirectly; when accessed directly, they are automatically mapped to the SFR space;
The C51 compiler provides three different memory types to access internal RAM space: data, idata, and bdata;
2. Expand RAM
When accessing the extended RAM area, indirect access is performed through a data pointer register, so the reading and writing speed is slower than the internal RAM area.
The extended RAM area supports a maximum of 64K bytes of storage space, but these addresses are not necessarily all used for memory space. Some 8051 microcontrollers will map peripheral addresses to the extended RAM area.
The C51 compiler provides two different memory types to access the extended RAM space: xdata and pdata:
3. Program memory Flash
The 8051 architecture supports a maximum of 64K bytes of Flash space.
Program code is stored in Flash space, and 8051 can only execute code stored in Flash. Constant variables can also be stored in Flash space.
The way to access the Flash space is to use MOVC instruction for indirect addressing, not direct addressing;
3. Special Function Registers
The 8051 architecture provides 128 bytes of memory space for special function registers (SFRs). SFRs and the upper 128 bytes of internal RAM share addresses 80H ~ FFH and can only be directly addressed.
It is a collection of multiple control registers and status registers, which is used to manage, control and monitor various functional modules within the microcontroller.
Previous article:Internal structure of MCS-51 single-chip microcomputer - CPU structure and single-chip microcomputer principle study notes (II)
Next article:8051 MCU Basics 5: Data Type Occupancy Size and Value Range
- Popular Resources
- Popular amplifiers
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
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Filter capacitors in EMC protection
- Internet of Things vs Industrial Internet of Things: 10 Differences That Matter
- A new interpretation of the principle of integral circuits: the transformation of amplifiers and capacitors
- How to achieve two-way voltage regulation output with 2SC8050 boost circuit
- Is there anyone who knows Mitsubishi PLC?
- Live broadcast at 10 am today [TI SimpleLink wireless platform latest software and hardware solutions]
- Bidirectional 5V, 3.3V logic level conversion circuit
- LT3514 step-down followed by optocoupler
- Microphone preamplifier circuit
- STM32 uses CycloneTCP protocol, HTTP 301/302 response problem