Chip decryption knowledge: the arithmetic unit of the microcontroller

Publisher:平安守护Latest update time:2011-10-09 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The arithmetic unit is based on the ALU, which is a binary arithmetic/logic operation unit, and is supplemented by the temporary register TMP, the accumulator ACC, the register B, the program status flag register PSW, and the Boolean processor. The accumulator ACC is an eight-bit register, which is the most frequently used register in the CPU. When performing arithmetic and logical operations, the accumulator ACC often temporarily stores an operand (such as the addend) before the operation, and saves the result (such as the algebraic sum) after the operation. Register B is mainly used for multiplication and division operations. The flag register PSW is also an eight-bit register, which is used to store some characteristics of the operation result, such as whether there is a carry or borrow. The specific meaning of each bit is as follows. PSW CY AC FO RS1 RS0 OV - P For users, the following four bits are of most concern.
1? Carry flag CY (PSW?7). It indicates whether there is a carry (or borrow) in the operation. If the operation result has a carry (addition) or a borrow (subtraction) in the highest bit, this bit is 1, otherwise it is 0.
2? Auxiliary carry flag AC Also known as the half-carry flag, it reflects whether there is a half-carry in the lower four bits of the two eight-digit operation, that is, whether there is a carry (or borrow) when adding (or subtracting) the lower four bits. If so, AC is in the 1 state, otherwise it is 0.
3? Overflow flag OV. MCS-51 reflects whether the operation result of the signed number overflows. If there is an overflow, this bit is 1, otherwise it is 0.
4? Parity flag P. Reflects the parity of the content of the accumulator ACC. If the operation result in ACC has an even number of 1s (such as 11001100B, which has 4 1s), P is 0, otherwise, P=1.
The other bits of PSW will be introduced later. Since PSW stores the status of program execution, it is also called the program status word? There is also a logic processor (also known as a Boolean processor) in the operator that performs logical operations on a bit basis. Its function will be explained when introducing bit instructions.

Reference address:Chip decryption knowledge: the arithmetic unit of the microcontroller

Previous article:The main hardware circuit of ultrasonic rangefinder based on single chip microcomputer
Next article:What are the causes of chip deflection?

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号