ATmega64 Status Register

Publisher:BlissfulHeartLatest update time:2021-11-22 Source: eefocusKeywords:ATmega64 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.


AVR status register SREG is defined as follows

ATmega64 Status Register

• Bit 7 – I: Global Interrupt Enable
I enables global interrupts when set. Individual interrupts are enabled by separate control registers. If I is cleared, no interrupt occurs regardless of whether the individual interrupt flags are set. I is cleared after any interrupt occurs and is set again to enable interrupts after the RETI instruction is executed. I can also be set and cleared by the SEI and CLI instructions.

• Bit 6 – T: Bit Copy Store
The bit copy instructions BLD and BST use T as the destination or source address. BST copies a bit in a register to T, while BLD copies T to a bit in 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 instruction set description 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: The carry flag
indicates that a carry has occurred in an arithmetic or logical operation. See the instruction set description for details.



Keywords:ATmega64 Reference address:ATmega64 Status Register

Previous article:ATmega64 Stack Pointer
Next article:ATmega64 General Registers

Latest Microcontroller Articles
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号