Datasheet

12.6 Register Description
12.6.1 Accessing 16-Bit Registers
The AVR data bus is 8-bits wide, so accessing 16-bit registers requires atomic operations. These
registers must be byte-accessed using two read or write operations. 16-bit registers are connected to the
8-bit bus and a temporary register using a 16-bit bus.
For a write operation, the high byte of the 16-bit register must be written before the low byte. The high
byte is then written into the temporary register. When the low byte of the 16-bit register is written, the
temporary register is copied into the high byte of the 16-bit register in the same clock cycle.
For a read operation, the low byte of the 16-bit register must be read before the high byte. When the low
byte register is read by the CPU, the high byte of the 16-bit register is copied into the temporary register
in the same clock cycle as the low byte is read. When the high byte is read, it is then read from the
temporary register.
This ensures that the low and high bytes of 16-bit registers are always accessed simultaneously when
reading or writing the register.
Interrupts can corrupt the timed sequence if an interrupt is triggered and accesses the same 16-bit
register during an atomic 16-bit read/write operation. To prevent this, interrupts can be disabled when
writing or reading 16-bit registers.
The temporary registers can be read and written directly from user software.
Note:  For more information, refer to Accessing 16-bit Timer/Counter registers.
Related Links
20.6 Accessing 16-bit Timer/Counter Registers
ATmega48PA/88PA/168PA
AVR Memories
© 2018 Microchip Technology Inc.
Datasheet Complete
DS40002011A-page 44