josuah.net

ATmega328P

MCU with AVR 8-bit architecture.

ATmega328P on Elegoo Nano

Can still use 16-bit addresses through "pointer registers" pair of register splitting upper and lower bits: X (R26 low, R27 high), Y (R28 low, R29 high), Z (R30 low, R31 high).

IO(0x0000-0x001F) - IO Space

Addresses for communicating through the MCU pins. Every bit are mapping to one pin, grouped into ports.

When using the I/O specific commands IN and OUT, the I/O addresses 0x00 - 0x3F must be used. When addressing I/O registers as data space using LD and ST instructions, 0x20 must be added to these addresses.

Encountered as #define __SFR_OFFSET 0x20 in <avr/sfr_defs.h>.

PROG(0x0000-0x0032) - Interrupt handlers addresses