51 MCU internal resources

51 MCU internal resources


Controller

Insert picture description here
Functions:
1. Fetch the next instruction to be executed from the memory (fetch instruction)
2. Decode (decode) the fetched instruction
3. Command arithmetic unit to operate or control data transmission (command)

Program counter PC (program counter)

1. PC is a 16-bit special register, which is controlled by the CPU to provide the first address of the next execution instruction.
2. It is automatically incremented by 1 when the program is running (run in sequence).
3. The value is 0000H when reset, and the program starts from 0.
4. Instruction modification function realizes jump operation program

Instruction register IR (instruction register)

1. IR is an 8-bit register, used to temporarily store commands to be executed

Instruction decoder ID (instruction decoder)

1. ID is an 8-bit register, used to decode the instructions of the register and convert the program into a circuit signal

Data pointer DPTR (data pointer)

1. DPTR is a 16-bit dedicated address pointer register, composed of two 8-bit registers DPH (high) and DPL (low).
2. It can be used to store on-chip and off-chip ROM addresses and off-chip RAM addresses

Arithmetic unit

Insert picture description here

Functions:
1. Calculate the data in the register
2. Save the result in ACC
3. Reflect the running status in PSW

Accumulator ACC (accumulator)

1. ACC is an 8-bit register
2. Stores operands or intermediate calculation results
3. Connects to ALU through a scratchpad

Arithmetic logic unit ALU (arithmetic logic unit)

Program state word register PSW (program state word)

1. PSW is an 8-bit special register used to store various status information during program operation.
2. The bit information in PSW is mostly automatically formed during the execution of instructions, and can also be changed by transmission instructions.
Insert picture description here
1) CY (PSW.7 ) Carry flag: CY is set by hardware when there is a carry or borrow in the highest bit of the result during addition and subtraction operations, otherwise it is cleared to 0
a, can be used to determine whether there is a carry or borrow during addition and subtraction operations
b, in bit operation Can be used as an accumulator

2) AC (PSW.6) auxiliary carry flag: during addition and subtraction operations, if there is a carry or borrow from the lower four bits to the higher four bits of the result, CY is set by hardware, otherwise it is cleared to 0
a, can be used to judge addition and subtraction operations Whether there is half-carry or half-borrow
b. The AC flag is used in the BCD code adjustment operation

3) F0 (PSW.5) user mark for user definition

4) RS1, RS0 (PSW.4, 3) working register pointers, used to select register groups
Insert picture description here

5) OV (PSW.2) overflow flag: set to 1 when there is an abnormal result in signed operation or multiplication and division operation, otherwise clear to 0
a, can be used to judge whether signed operation or multiplication and division operation is abnormal

6. F1 (PSW.1) user mark for customization

7. P (PSW.0) parity flag bit: if there is an odd number of 1s in the accumulator A, set it to 1, otherwise it is set to 0
a. It can be used for data verification in communication to determine whether there is a transmission error

Guess you like

Origin blog.csdn.net/qq_35942256/article/details/114898082