What is the function of the program status register PSW of the MCS-51 microcontroller?

Publisher:chaohuangmeitaoLatest update time:2013-02-27 Source: 21IC Keywords:MCS-51 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

What is the function of the program status register PSW of the MCS-51 microcontroller? What are the bits of the commonly used flags? What is their function?

Answer: PSW is an 8-bit register used to set the CPU status and indicate the status after instruction execution.

CY (PSW.7): ​​Carry flag. When executing addition or subtraction instructions, if the highest bit (D7) of the operation result has a carry or borrow, CY is automatically set to 1 by hardware.

AC (PSW.6): Half carry flag, also known as auxiliary flag. When executing addition and subtraction instructions, if the lower half byte (D3) of the operation result has a carry or borrow to the upper half byte, AC is automatically set to 1 by hardware.

F0, F1 (PSW.5 and PSW.1): User flag bits. Users can assign certain meanings to F0 and F1 as needed, and set them to 1 or clear them to 0 as software flags.

RS1, RS0 (PSW.4 and PSW.3): Working register group selection control bits. By setting these two bits, one of the four working register groups can be selected as the current working register.

OV (PSW.2): Overflow flag. There are two situations that affect this bit. First, when performing addition or subtraction operations, if any one of D7 or D6 has a carry or borrow, OV is automatically set to 1.

P (PSW.0): Parity flag. After each instruction is executed, this bit will indicate the number of 1s in the current accumulator A. If there is an odd number of 1s in A, P is automatically set to 1.

Keywords:MCS-51 Reference address:What is the function of the program status register PSW of the MCS-51 microcontroller?

Previous article:Design of intelligent oil temperature detection and alarm system based on single chip microcomputer
Next article:MCS-51 MCU Boolean Processor Storage Space Allocation

Recommended ReadingLatest update time:2024-11-16 14:30

The composition of MCS-51 single chip microcomputer memory
1. Program memory  On-chip program memory  Off-chip program memory  2. Data memory  On-chip RAM 128B  Off-chip RAM max64KB  3. Special function registers (SFR)  4. Bit memory
[Microcontroller]
Summary of MCS-51 MCU instruction system
The MCS-51 single-chip microcomputer instruction system has a total of 111 instructions, which are divided into five categories according to their functions: (1) Data transmission class 28 (2) Arithmetic operations 24 (3) Logical operations 25 (4) Control transfer category 17 (5) Bit operation class 17 (1) Data tran
[Microcontroller]
Solutions for different application situations of MCS-51 single chip microcomputer timing interrupt
The interrupt response delay time of the MCS-51 microcontroller depends on whether other interrupt service routines are in progress, or on what instruction is being executed. The interrupt response time in a single interrupt system is 3 to 8 machine cycles . Regardless of the cause of the error, their impact must be
[Microcontroller]
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号