16
ATtiny22/22L
I/O Memory
The I/O space definition of the ATtiny22/L is shown in the following table:
Note:
Reserved and unused locations are not shown in the table.
All the different ATtiny22/L I/O and peripherals are placed in the I/O space. The different I/O locations are accessed by the
IN and OUT instructions transferring data between the 32 general purpose working registers and the I/O space. I/O
registers within the address range $00 - $1F 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
chapter for more details. When using the I/O specific commands IN, OUT the I/O addresses $00 - $3F must be used. When
addressing I/O registers as SRAM, $20 must be added to this address. All I/O register addresses throughout this document
are shown with the SRAM address in parentheses.
For compatibility with future devices, reserved bits should be written to zero if accessed. Reserved I/O memory addresses
should never be written.
Some of the status flags are cleared by writing a logical one to them. Note that the CBI and SBI instructions will operate on
all bits in the I/O register, writing a one back into any flag read as set, thus clearing the flag. The CBI and SBI instructions
work with registers $00 to $1F only.
The different I/O and peripherals control registers are explained in the following sections.
Status Register - SREG
The AVR status register - SREG - at I/O space location $3F ($5F) is defined as:
Table 1. ATtiny22/L I/O Space
Address Hex
Name
Function
$3F ($5F)
SREG
Status REGister
$3D ($5D)
SPL
Stack Pointer Low
$3B ($5B)
GIMSK
General Interrupt MaSK register
$3A ($5A)
GIFR
General Interrupt Flag Register
$39 ($59)
TIMSK
Timer/Counter Interrupt MaSK register
$38 ($58)
TIFR
Timer/Counter Interrupt Flag register
$35 ($55)
MCUCR
MCU Control Register
$34 ($54)
MCUSR
MCU Status Register
$33 ($53)
TCCR0
Timer/Counter 0 Control Register
$32 ($52)
TCNT0
Timer/Counter 0 (8-bit)
$21 ($41)
WDTCR
Watchdog Timer Control Register
$1E ($3E)
EEAR
EEPROM Address Register
$1D ($3D)
EEDR
EEPROM Data Register
$1C ($3C)
EECR
EEPROM Control Register
$18 ($38)
PORTB
Data Register, Port B
$17 ($37)
DDRB
Data Direction Register, Port B
$16 ($36)
PINB
Input Pins, Port B
Bit
7
6
5
4
3
2
1
0
$3F ($5F)
I
T
H
S
V
N
Z
C
SREG
Read/Write
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Initial value
0
0
0
0
0
0
0
0