Through the study of the previous lessons, we already know that there are ROM, RAM, and parallel I/O ports inside the microcontroller. So, besides these things, what else is there inside the microcontroller? How are these pieces of things connected together?
Let's take a complete analysis of the inside of the microcontroller!
From the figure we can see that there is a CPU inside the 51 MCU for operation and control. There are four parallel I/O ports, which are P0, P1, P2, P3, and ROM, which are used to store programs and have RAM. Used to store intermediate results, in addition to timer/counter, serial I/O port, interrupt system, and an internal clock circuit. There are so many things inside a 51 MCU.
For further analysis of the graph, we know that reading and writing to the parallel I/O port is as long as the data is sent to the latch of the corresponding I/O port, then for the timer/counter, serial I/O How to use the mouth? There are separate memory locations in the microcontroller that are used to control these devices and are referred to as Special Function Registers (SFRs). In fact, we have already touched the special function register of P1. What else? See the table below
symbol
address
Features
B
F0H
B register
ACC
E0H
accumulator
PSW
D0H
Program status word
IP
B8H
Interrupt priority control register
P3
B0H
P3 port latch
IE
A8H
Interrupt enable control register
P2
A0H
P2 port latch
SBUF
99H
Serial port latch
SCON
98H
Serial port control register
P1
90H
P1 port latch
Th1
8DH
Timer/Counter 1 (high 8 bits)
TH0
8CH
Timer/Counter 1 (lower 8 bits)
TL1
8BH
Timer/Counter 0 (high 8 bits)
TL0
8AH
Timer/Counter 0 (lower 8 bits)
TMOD
89H
Timer/counter mode control register
TCON
88H
Timer/counter control register
DPH
83H
Data address pointer (high 8 bits)
DPL
82H
Data address pointer (lower 8 bits)
SP
81H
Stack pointer
P0
80H
P0 port latch
PCON
87H
Power control register
Below, we introduce a few commonly used SFRs.
1, ACC--- is an accumulator, usually denoted by A.
This is something, can't be understood from the name, it is a register, not a thing to do addition, why give it a name? Perhaps it is because one of the numbers must be in the ACC when the operator is doing the operation. Its name is special and its identity is special. We will learn the instructions later in the middle part, and we can find that all the arithmetic instructions are inseparable from it. It has its own zero mark Z, Z = 1 if A = 0, and z = 0 if A ≠0. This flag is often used as a condition for the branching of program branches.
2, B - a register.
When you do multiplication or division in multiplication or division, do not do multiplication and division, how to use it.
3, PSW-----program status word. This is a very important thing, which puts a lot of state when the CPU works, so that we can understand the current state of the CPU and handle it accordingly. Please see the table below for its features:
Let's introduce each person's use one by one.
CY: Carry flag. The 8051 operator is an 8-bit arithmetic unit. We know that the 8-bit operator can only represent 0-255. If adding, the two numbers may add more than 255, so the highest bit will be lost. What should I do if I am causing an error in the operation? The highest position will come here. This will be fine. There are advances, borrows, CY=1; no advance, borrow, CY=0
Example: 78H+97H (01111000+10010111)
AC: Auxiliary advance and borrow (bits and borrows between the high nibble and the lower nibble).
Example: 57H+3AH (01010111+00111010)
F0: User flag, determined by the user (programmer) when to use, when not to use.
RS1, RS0: Working register group selection bit. This is what we know.
0V: Overflow flag. The result of the operation is understood by the complement operation. There is overflow, OV=1; no overflow, OV=0. What is overflowing will be covered in the chapters that follow us.
P: Parity: It is used to indicate the parity of the number of binary digits "1" in the ALU operation result. If it is an odd number, P=1, otherwise it is 0. The result of the operation has an odd number of 1, P = 1; the result of the operation has an even number of 1, P = 0.
Example: The result of a certain operation is 78H (01111000). Obviously, the number of 1 is even, so P=0.
4, P0, P1, P2, P3------ This we already know, is the register of four parallel input / output ports. The content inside it corresponds to the output of the pin.
5, IE-----interrupt charge register
Bitwise addressing, address: A8H
EA (IE.7): When EA=0, all interrupts are disabled (ie no interrupt is generated)
When EA=1, the generation of each interrupt is determined by the individual allowable bits.
- (IE.6): Reserved
ET2 (IE.5): Timed 2 overflow interrupt is reserved (for 8052)
ES (IE.4): Serial port interrupt is allowed (ES=1 is allowed, ES=0 is disabled)
ET1 (IE.3): Timed 1 interrupt is allowed
EX1 (IE.2): External interrupt INT1 interrupt is allowed
ET0 (IE.1): Timer 0 interrupt is allowed
EX0 (IE.0): External interrupt INT0 interrupt enable
7, IP-----interrupt priority control register
Bitwise addressing, address bit B8H
6, pointer register
(1) Program Counter PC
Indicates the address of the next instruction to be executed, 16 bits, addressing the 64KB range,
PC = 0000H on reset
(2) Stack pointer SP
Indicates the address of the top element of the stack, 8 bits, which can be set by software. SP = 07H at reset
(3) Data pointer DPtr
@R0, @R1, @DPtr; indicates the unit address of the accessed data memory, 16 bits, and the addressing range is 64 KB. DPtr = DPH + DPL. It can be used to access any unit in the external data memory. If it is not used, it can also be used as a general-purpose register. We decide how to use it. Divided into two registers, DPL (lower 8 bits) and DPH (higher 8 bits). It is used to store 16-bit address values ​​to perform data operations in the 64K byte range for off-chip data RAM or program memory by means of indirect or indexed addressing.
7, timing / counter
(1) Timer mode register: TMOD
(2) Timer Control Register: TCON
(3) Count register: TH0, TL0; Th1, TL1. Can be used to set the initial value of the count.
8052/8032 add special register
(1) Timer 2 control register T2CON; control, set the working mode.
(2) Count register: Th2, TL2
(3) Timer 2 capture/reload registers: RCAP2H, RCAP2L
Store data that is automatically reloaded to Th2 and TL2.
Perfect fit: The Hydrogel Screen Protector is designed with a Soft TPU material, which can be completely covered even on a curved device, providing perfect protection for the full coverage of the screen.
Oleophobic and waterproof: The use of hydrophobic and oleophobic screen coatings can prevent sweat, grease residue and fingerprints without reducing screen sensitivity. It is almost invisible on the screen and brings a high-definition visual experience.
Sensitive touch: ultra-thin and Soft Hydrogel Film with a thickness of only 0.14mm. As time goes by, it will self-repair minor scratches, provide you with a highly responsive screen protector and maintain the original touch.
Easy to install: The installation of the Protective Film is very simple, without air bubbles. The protective sticker can stay on the phone perfectly, and the bubbles will disappear within 24 hours.
If you want to know more about Hydrogel Screen Protector products, please click the product details to view the parameters, models, pictures, prices and other information about Hydrogel Screen Protective Film.
Whether you are a group or an individual, we will try our best to provide you with accurate and comprehensive information about the Hydrogel Protective Film!
Hydrogel TPU Protective Film,Ultra-Thin Protective Film,Soft Hydrogel Film,Hydrogel Film Screen Protector,Screen Protective Film,Mobile Phone Screen Guards
Shenzhen Jianjiantong Technology Co., Ltd. , https://www.jjthydrogelmachine.com