11.07.2015 Views

ATMega chip full datasheet - UCSD Department of Physics

ATMega chip full datasheet - UCSD Department of Physics

ATMega chip full datasheet - UCSD Department of Physics

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ATmega48A/PA/88A/PA/168A/PA/328/Pspecified in the Instruction Set Reference. This will in many cases remove the need for using thededicated compare instructions, resulting in faster and more compact code.The Status Register is not automatically stored when entering an interrupt routine and restoredwhen returning from an interrupt. This must be handled by s<strong>of</strong>tware.7.3.1 SREG – AVR Status RegisterThe AVR Status Register – SREG – is defined as:Bit 7 6 5 4 3 2 1 00x3F (0x5F) I T H S V N Z C SREGRead/Write R/W R/W R/W R/W R/W R/W R/W R/WInitial Value 0 0 0 0 0 0 0 0• Bit 7 – I: Global Interrupt EnableThe Global Interrupt Enable bit must be set for the interrupts to be enabled. The individual interruptenable control is then performed in separate control registers. If the Global Interrupt EnableRegister is cleared, none <strong>of</strong> the interrupts are enabled independent <strong>of</strong> the individual interruptenable settings. The I-bit is cleared by hardware after an interrupt has occurred, and is set bythe RETI instruction to enable subsequent interrupts. The I-bit can also be set and cleared bythe application with the SEI and CLI instructions, as described in the instruction set reference.• Bit 6 – T: Bit Copy StorageThe Bit Copy instructions BLD (Bit LoaD) and BST (Bit STore) use the T-bit as source or destinationfor the operated bit. A bit from a register in the Register File can be copied into T by theBST instruction, and a bit in T can be copied into a bit in a register in the Register File by theBLD instruction.• Bit 5 – H: Half Carry FlagThe Half Carry Flag H indicates a Half Carry in some arithmetic operations. Half Carry Is usefulin BCD arithmetic. See the “Instruction Set Description” for detailed information.• Bit 4 – S: Sign Bit, S = N ⊕ VThe S-bit is always an exclusive or between the Negative Flag N and the Two’s ComplementOverflow Flag V. See the “Instruction Set Description” for detailed information.• Bit 3 – V: Two’s Complement Overflow FlagThe Two’s Complement Overflow Flag V supports two’s complement arithmetic. See the“Instruction Set Description” for detailed information.• Bit 2 – N: Negative FlagThe Negative Flag N indicates a negative result in an arithmetic or logic operation. See the“Instruction Set Description” for detailed information.• Bit 1 – Z: Zero FlagThe Zero Flag Z indicates a zero result in an arithmetic or logic operation. See the “InstructionSet Description” for detailed information.• Bit 0 – C: Carry FlagThe Carry Flag C indicates a carry in an arithmetic or logic operation. See the “Instruction SetDescription” for detailed information.8271D–AVR–05/1111

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!