当前位置:网站首页>[MCU] 2.3 CPU of AT89S52
[MCU] 2.3 CPU of AT89S52
2022-07-27 17:57:00 【tsunaa】
2.3 AT89S52 Of CPU
- CPU from Arithmetic unit and controller constitute .
2.3.1 Arithmetic unit
- Arithmetic on operands 、 Logic and bit operations . It mainly includes arithmetic and logic operation unit ALU、 accumulator A、 Bit processor 、 Program status word register PSW And two registers .
1. Arithmetical logic unit ALU
- But for 8 Bit variable logic operation ( And 、 or 、 Exclusive or 、 loop 、 Make up and clear ), Still can Arithmetic operations ( Add 、 reduce 、 ride 、 except )
- ALU also Bit operation function , Bit processing of bit variables , If you set “1”、 clear “0”、 Make up 、 Test transfer and logic “ And ”、“ or ” etc. .
2. accumulator A
- The most frequently used register , Can be written as Acc.“A” And “Acc” Differences in writing , In the fourth 3 Chapter introduction . Special function register area located in the chip .
- It works as follows :
* (1)ALU One of the input data sources of the unit , again ALU Storage of operation results unit .
* (2) Data transfer Mostly through accumulators A, Equivalent to a data transfer station . To solve the problem “ The bottleneck is blocked ” problem ,AT89S52 Added a part of transmission instructions that can not pass through the accumulator . - A Carry flag of Cy It's special , Because it is also Bit accumulator of bit processor .
3. Program status word register PSW
- PSW(Program Status Word) Located in the on-chip special function register area , Byte address is D0H.
- Contains Information about the running status of the program , among 4 Bit saves the status of the current instruction after execution , For program inquiry and judgment . The format is as shown in the figure 2-5 Shown .

- PSW Functions of each bit in :
- (1)Cy(PSW.7) Carry flag bit
- Can be written as C. In arithmetic and logical operations , if Have carry / Borrow position ,Cy=1; otherwise ,Cy=0. In the bit processor , It's a bit accumulator .
- (2)Ac(PSW.6) Auxiliary carry flag bit
- stay BCD Code operation , Used as a decimal adjustment . When D3 Orientation D4 When a carry or borrow occurs ,Ac=1; otherwise ,Ac=0.
- (3)F0(PSW.5) The user sets the flag bit
- A status flag bit used by the user , Instructions can be used to set it 1 Or Qing 0, Control the flow direction of the program . Users should make full use of .
- (4)RS1、RS0(PSW.4、PSW.3)4 Group work register area selection
- Select on-chip RAM In the district 4 A group in the group working register area is the current working register area, as shown in table 2-2.

- Select on-chip RAM In the district 4 A group in the group working register area is the current working register area, as shown in table 2-2.
- (5)OV(PSW.2) overflow flag
- When executing arithmetic instructions , Used to indicate whether the operation result overflows . If the result is overflow ,OV=1; otherwise ,OV=0.
- (6)PSW.1 position : Keep a
- (7)P(PSW.0) Parity flag bit
- Command execution completed , accumulator A in “1” Whether the number of is odd or even .
- P=1, Express A in “1” The number of Odd number .
- P=0, Express A in “1” The number of even numbers .
- This flag bit is of great significance for serial communication , Commonly used Parity test To test the reliability of data serial transmission .
- Command execution completed , accumulator A in “1” Whether the number of is odd or even .
- (1)Cy(PSW.7) Carry flag bit
2.3.2 controller
- Mission : Identification instruction , And according to the nature of the instructions, control the functional components of the single chip microcomputer , So as to ensure that all parts of the single chip microcomputer can work automatically and harmoniously .
- The controller includes : Program counter 、 Instruction register 、 Instruction decoder 、 Timing and control logic circuit, etc . The function is to control the reading of instructions 、 Decoding and execution , Thus, the timing and logic control of each functional component .
- Program counter PC It's an independent 16 Bit counter , inaccessible . When the MCU is reset ,PC The content of 0000H, From program memory 0000H Unit fetch instruction , Start the program .
- PC working process :CPU When reading instructions ,PC As the address of the fetched instruction , The program memory outputs instruction bytes at this address , meanwhile PC Automatic addition 1.
- PC Content change track in Determine the process . When Sequential execution Automatically add 1; perform Transfer program or Subroutines 、 Interrupt subroutine call when , Automatically change its contents to the destination address to be transferred .
- PC Count width of Determines the address range of the program memory .PC by 16 position , Therefore, we can **64KB(=2^16B)** Addressing .
边栏推荐
- Establishing SSL connection without server‘s identity verification is not recommended
- 卷积神经网络之卷积计算过程个人理解
- General process of background management system permission setting
- PostgreSQL 14 支持winserver2022吗?
- JS to realize the right-click menu bar function
- Wechat applet cloud function batch delete multiple data error: errcode: -502005 database collection not exists
- 交换机和路由器技术-03-交换机基本配置
- Likeshop takeout ordering system "100% open source without encryption"
- Initial polymorphism
- Mysql database defines cursor in trigger
猜你喜欢

DDD(领域驱动设计)分层架构

Interviewer: what is scaffolding? Why do you need scaffolding? What are the commonly used scaffolds?

微信小程序 实现拨打电话

初识多态

Likeshop takeout ordering system "100% open source without encryption"

Compilation and testing of raspberry pie driver code

Kubernetes 1.24 high availability cluster binary deployment

知物由学 | 易盾移动端同构实践,几步改善官网交互体验

Lichuang EDA - PCB layout (IV)

Switch and router technology-03-basic configuration of switch
随机推荐
卷积神经网络之卷积计算过程个人理解
【数据库系统概论(王珊)】第5章——数据库完整性
vim的配置及基础使用
Zhengzhou University database course resource description
Chery omenda is also too similar to Chang'an uni-t, but does it look like it? Is the product power like it?
Coca Cola's primary challenge is not vitality forest
Today's sleep quality record 82 points
Gods at dusk, "cat trembles" bid farewell to the big V Era
Windows与网络基础-15-本地安全策略
Common shell commands (1) -- variable case conversion
Mlx90640 infrared thermal imager temperature sensor module development notes (VII)
Dense optical flow extraction dense_ Flow understanding
Could not obtain transaction-synchronized Session for current thread
阿里巴巴鹰眼系统简介
风口之下,隐形正畸还能走多远?
Wechat applet to make calls
【cf】#681 A. Kids Seating (Div. 2, based on VK Cup 2019-2020 - Final)
[MCU] 2.2 pin function of AT89S52
交换机和路由器技术-03-交换机基本配置
Interviewer: what is scaffolding? Why do you need scaffolding? What are the commonly used scaffolds?