7.10 I/O Memory
All ATmega4808/4809 I/Os and peripherals are
located in the I/O space. The I/O address range from 0x00 to 0x3F can be accessed in a
single cycle using IN
and OUT
instructions. The
extended I/O space from 0x0040 - 0x0FFF can be accessed by the
LD/LDS/LDD
and ST/STS/STD
instructions,
transferring data between the 32 general purpose working registers and the I/O space.
I/O registers within the address range 0x00 - 0x1F are directly
bit-accessible using the SBI
and CBI
instructions. In
these registers, the value of single bits can be checked by using the
SBIS
and SBIC
instructions. Refer to the
Instruction Set section for more details.
For compatibility with future devices, reserved bits should be written to
‘0’
if accessed. Reserved I/O memory addresses should never be
written.
Some of the interrupt flags are cleared by writing a ‘1’
to
them. On ATmega4808/4809 devices, the CBI
and
SBI
instructions will only operate on the specified bit, and can,
therefore, be used on registers containing such interrupt flags. The
CBI
and SBI
instructions work with registers 0x00
- 0x1F only.
General Purpose I/O Registers
The ATmega4808/4809 devices provide four General
Purpose I/O Registers. These registers can be used for storing any information, and they
are particularly useful for storing global variables and interrupt flags. General
Purpose I/O Registers, which reside in the address range 0x1C - 0x1F, are directly
bit-accessible using the SBI
, CBI
,
SBIS
, and SBIC
instructions.