81
ATtiny26(L)
1477G–AVR–03/05
Register Descriptions
USI Data Register – USIDR
The USI uses no buffering of the serial register, i.e., when accessing the Data Register
(USIDR) the serial register is accessed directly. If a serial clock occurs at the same cycle
the register is written, the register will contain the value written and no shift is performed.
A (left) shift operation is performed depending of the USICS1..0 bits setting. The shift
operation can be controlled by an external clock edge, by a Timer/Counter0 overflow, or
directly by software using the USICLK strobe bit. Note that even when no wire mode is
selected (USIWM1..0 = 0) both the external data input (DI/SDA) and the external clock
input (SCK/SCL) can still be used by the Shift Register.
The output pin in use, DO or SDA depending on the wire mode, is connected via the out-
put latch to the most significant bit (bit 7) of the Data Register. The output latch is open
(transparent) during the first half of a serial clock cycle when an external clock source is
selected (USICS1 = 1), and constantly open when an internal clock source is used
(USICS1 = 0). The output will be changed immediately when a new MSB written as long
as the latch is open. The latch ensures that data input is sampled and data output is
changed on opposite clock edges.
Note that the corresponding Data Direction Register (DDRB2/1) to the pin must be set to
one for enabling data output from the Shift Register.
USI Status Register – USISR
The Status Register contains interrupt flags, line status flags and the counter value.
Note that doing a Read-Modify-Write operation on USISR Register, i.e., using the SBI or
CBI instructions, will clear pending interrupt flags. It is recommended that register con-
tents is altered by using the OUT instruction only.
• Bit 7 – USISIF: Start Condition Interrupt Flag
When Two-wire mode is selected, the USISIF flag is set (to one) when a start condition
is detected. When output disable mode or Three-wire mode is selected and (USICSx =
0b11 & USICLK = 0) or (USICS = 0b10 & USICLK = 0), any edge on the SCK pin sets
the flag.
An interrupt will be generated when the flag is set while the USISIE bit in USICR and the
Global Interrupt Enable Flag are set. The flag will only be cleared by writing a logical one
to the USISIF bit. Clearing this bit will release the start detection hold of SCL in Two-wire
mode.
A start condition interrupt will wakeup the processor from all four sleep modes.
• Bit 6 – USIOIF: Counter Overflow Interrupt Flag
This flag is set (one) when the 4-bit counter overflows (i.e., at the transition from 15 to
0). An interrupt will be generated when the flag is set while the USIOIE bit in USICR and
the Global Interrupt Enable Flag are set. The flag will only be cleared if a one is written
Bit
7
6
5
4
3
2
1
0
$0F ($2F)
MSB
LSB
USIDR
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
Bit
7
6
5
4
3
2
1
0
$0E ($2E)
USISIF
USIOIF
USIPF
USIDC
USICNT3
USICNT2
USICNT1
USICNT0
USISR
Read/Write
R/W
R/W
R/W
R
R/W
R/W
R/W
R/W
Initial Value
0
0
0
0
0
0
0
0