115
ATtiny25/45/85 [DATASHEET]
2586Q–AVR–08/2013
15.5
Register Descriptions
15.5.1
USIDR – USI Data Register
The USI Data Register can be accessed directly but a copy of the data can also be found in the USI Buffer
Register.
Depending on the USICS[1:0] bits of the USI Control Register a (left) shift operation may be performed. The shift
operation can be synchronised to an external clock edge, to a Timer/Counter0 Compare Match, or directly to soft-
ware via the USICLK bit. 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.
Note that even when no wire mode is selected (USIWM[1:0] = 0) both the external data input (DI/SDA) and the
external clock input (USCK/SCL) can still be used by the USI Data Register.
The output pin (DO or SDA, depending on the wire mode) is connected via the output latch to the most significant
bit (bit 7) of the USI Data Register. The output latch ensures that data input is sampled and data output is changed
on opposite clock edges. The latch is open (transparent) during the first half of a serial clock cycle when an exter-
nal 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 is written as long as the latch is open.
Note that the Data Direction Register bit corresponding to the output pin must be set to one in order to enable data
output from the USI Data Register.
15.5.2
USIBR – USI Buffer Register
Instead of reading data from the USI Data Register the USI Buffer Register can be used. This makes controlling
the USI less time critical and gives the CPU more time to handle other program tasks. USI flags as set similarly as
when reading the USIDR register.
The content of the USI Data Register is loaded to the USI Buffer Register when the transfer has been completed.
15.5.3
USISR – USI Status Register
The Status Register contains interrupt flags, line status flags and the counter value.
Bit 7 – USISIF: Start Condition Interrupt Flag
When two-wire mode is selected, the USISIF Flag is set (to one) when a start condition has been detected. When
three-wire mode or output disable mode has been selected any edge on the SCK pin will set the flag.
Bit
7
6
5
4
3
2
1
0
MSB
LSB
USIDR
Read/Write
R/W
Initial Value
0
Bit
7
6
5
4
3
2
1
0
MSB
LSB
USIBR
Read/Write
R
Initial Value
0
Bit
7
6
5
4
3
2
1
0
USISIF
USIOIF
USIPF
USIDC
USICNT3
USICNT2
USICNT1
USICNT0
USISR
Read/Write
R/W
R
R/W
Initial Value
0