SREG

Abstract

The SREG is a status register of ATmega328P.

Source Code

The SREG is defined in hardware/tools/avr/avr/include/avr/common.h as below.

1
2
3
4
5
6
7
8
9
#define SREG _SFR_IO8(0x3F)
#  define SREG_C  (0)
#  define SREG_Z  (1)
#  define SREG_N  (2)
#  define SREG_V  (3)
#  define SREG_S  (4)
#  define SREG_H  (5)
#  define SREG_T  (6)
#  define SREG_I  (7)

0x3F is an I/O address of SREG. It calls _SFR_IO8().

The status register is a 8bit register. The meanings of each bit are shown below.

Bit76543210
ITHSVNZC

I: Global Interrupt Enable

T: Bit Copy Storage

H: Half Carry Flag

S: Sign Bit

V: Two’s Complement Overflow Flag

N: Negative Flag

Z: Zero Flag

C: Carry Flag

Version

7.3.0-atmel3.6.1-arduino7

Last Update

May 15, 2021

inserted by FC2 system