L04 - AVR CPU Registers

Microcontrollers and AVR Specific Information

CPU Registers

registers

1: General Purpose Registers
2: Status Register (SREG) – contains info about result of last executed instruction
3: Program Counter (PC) – Address of next instruction
4: Instruction Register (IR) – Holds fetched instruction
5: Stack Pointer (SP) – Points to top of stack

Stack

SP 0x1FFD 0x1FFE 0x1FFF

Note Table 6-1. from data sheet has all assembly Stack Pointer instructions.

Stack Pointer - SP

SP implementation in AVR

Status Register SREG

Status Register (SREG):

  1. Bit7:I: Global Interrupt Enable. Setting this bit enables all the interrupts. Resetting this disables all interrupts.
  2. Bit6:T: Bit Copy Storage. Used with BLD (bit load) and BST (bit store) ISTR for loading and storing bits from one register to another.
  3. Bit5:H. Half Carry Flag. Indicates half carry in some arithmetic ISTRs.
  4. Bit4:S. Sign Flag. This bit is the exclusive OR between the negative flag N and the Overflow flag V.
  5. Bit3:V. Two's Complement Overflow Flag.
  6. Bit2:N. Negative Flag.
  7. Bit1 :Z. Zero Flag. Indicates a zero result after an arithmetic or logical operation.
  8. Bit0:C. Carry Flag. Indicates a carry in arithmetic or logical operation.

Register File

Special Purpose Registers – X, Y, Z