134
AT94KAL Series FPSLIC
Rev. 1138G–FPSLI–11/03
The 2-wire Serial Data Register – TWDR
• Bits 7..0 - TWD: 2-wire Serial Data Register
These eight bits constitute the next data byte to be transmitted, or the latest data byte received
on the 2-wire Serial Bus.
In transmit mode, TWDR contains the next byte to be transmitted. In receive mode, the TWDR
contains the last byte received. It is writable while the 2-wire Serial Interface is not in the pro-
cess of shifting a byte. This occurs when the 2-wire Serial Interrupt flag (TWINT) is set by the
hardware. Note that the data register cannot be initialized by the user before the first interrupt
occurs. The data in TWDR remains stable as long as TWINT is set. While data is shifted out,
data on the bus is simultaneously shifted in. TWDR always contains the last byte present on
the bus, except after a wake up from Power-down Mode, or Power-save Mode by the 2-wire
Serial Interrupt. For example, in the case of the lost bus arbitration, no data is lost in the tran-
sition from Master-to-Slave. Receiving the ACK flag is controlled by the 2-wire Serial Logic
automatically, the CPU cannot access the ACK bit directly.
The 2-wire Serial (Slave) Address Register – TWAR
• Bits 7..1 - TWA: 2-wire Serial Slave Address Register
These seven bits constitute the Slave address of the 2-wire Serial Bus interface unit.
• Bit 0 - TWGCE: 2-wire Serial General Call Recognition Enable Bit
This bit enables, if set, the recognition of the General Call given over the 2-wire Serial Bus.
The TWAR should be loaded with the 7-bit Slave address (in the seven most significant bits of
TWAR) to which the 2-wire Serial Interface will respond when programmed as a Slave trans-
mitter or receiver, and not needed in the Master modes. The LSB of TWAR is used to enable
recognition of the general call address ($00). There is an associated address comparator that
looks for the Slave address (or general call address if enabled) in the received serial address.
If a match is found, an interrupt request is generated.
Bit
7
6
5
4
3
2
1
0
$1F ($3F)
MSB
LSB
TWDR
Read/Write
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Initial Value
1
1
1
1
1
1
1
1
Bit
7
6
5
4
3
2
1
0
$1E ($3E)
MSB
LSB
TWGCE
TWAR
Read/Write
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Initial Value
1
1
1
1
1
1
1
0