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
• 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.
Previous article:ATmega64 Stack Pointer
Next article:ATmega64 General Registers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- Kaige found a Guoxin product at the Expo that uses RISC-V to replace TI DSP. Are you interested in reviewing it?
- What the f*ck Python!
- MSP430FR5964 program download problem
- Take the survey and register for the Zurich Instruments seminar to win a Swiss Army Knife!
- Date Spring - Spring Harvest
- 【TouchGFX Design】+Simple solution to previous problems+
- DIY creative ideas come in~
- Setting trial time limit
- Anxinke PB-02 module evaluation (2) --- PHY62XX architecture introduction && design task introduction
- Migrate from M2M to IIoT