ATmega32 Status Register

Publisher:脑洞飞翔Latest update time:2021-11-26 Source: eefocusKeywords:ATmega32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The status register contains information about the results of the most recently executed arithmetic instruction. This information can be used to change the program flow to implement conditional operations. As described in the instruction set, all ALU operations will affect the contents of the status register. This eliminates the need for dedicated comparison instructions in many cases, making the system run faster and the code more efficient.


The status register will not be automatically saved when entering the interrupt service routine, nor will it be automatically restored when the interrupt returns. These tasks need to be handled by software.


The AVR interrupt register SREG is defined as follows:
· Bit 7 – I: Global interrupt enable
I enables global interrupts when set. Individual interrupt enable is controlled by other independent control registers. If I is cleared, no interrupt will be generated
regardless whether the individual interrupt flag is set or not. I is cleared after any interrupt occurs, and
I is set again to enable interrupts after executing the RETI instruction. I can also be set and cleared by the SEI and CLI instructions.
· Bit 6 – T: Bit copy storage
The bit copy instructions BLD and BST use T as the destination or source address. BST copies a bit of a register to T, while
BLD copies T to a bit of a register.
· Bit 5 – H: Half carry flag The half carry flag H indicates that a half carry has occurred in an arithmetic operation. This flag is very useful for BCD operations. See the description of
the instruction set for details . ·Bit 4 – S: Sign bit, S = N ⊕ V S is the exclusive OR of the negative flag N and the 2’s complement overflow flag V. See the instruction set description for details. ·Bit 3 – V: 2’s complement overflow flag supports 2’s complement operations. See the instruction set description for details. ·Bit 2 – N: Negative flag indicates that the result of an arithmetic or logical operation is negative. See the instruction set description for details. ·Bit 1 – Z: Zero flag indicates that the result of an arithmetic or logical operation is zero. See the instruction set description for details. ·Bit 0 – C: Carry flag indicates that a carry occurred in an arithmetic or logical operation. See the instruction set description for details.










Keywords:ATmega32 Reference address:ATmega32 Status Register

Previous article:ATmega32 General Registers
Next article:ATmega32 ALU

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号