Figure 102, Table 90, Atmega128(l) – Rainbow Electronics ATmega128L User Manual

Page 214

Advertising
background image

214

ATmega128(L)

2467B–09/01

Figure 102. Formats and States in the Slave Transmitter Mode

Table 90. Status Codes for Slave Transmitter Mode

Status Code
(TWSR)
Prescaler Bits
are 0

Status of the 2-wire Serial Bus and
2-wire Serial Interface Hardware

Application Software Response

Next Action Taken by TWI Hardware

To/from TWDR

To TWCR

STA

STO

TWINT

TWEA

$A8

Own SLA+R has been received;
ACK has been returned

Load data byte or

Load data byte

X

X

0

0

1

1

0

1

Last data byte will be transmitted and NOT ACK should
be received
Data byte will be transmitted and ACK should be re-
ceived

$B0

Arbitration lost in SLA+R/W as
master; own SLA+R has been
received; ACK has been returned

Load data byte or

Load data byte

X

X

0

0

1

1

0

1

Last data byte will be transmitted and NOT ACK should
be received
Data byte will be transmitted and ACK should be re-
ceived

$B8

Data byte in TWDR has been
transmitted; ACK has been
received

Load data byte or

Load data byte

X

X

0

0

1

1

0

1

Last data byte will be transmitted and NOT ACK should
be received
Data byte will be transmitted and ACK should be re-
ceived

$C0

Data byte in TWDR has been
transmitted; NOT ACK has been
received

No TWDR action or

No TWDR action or

No TWDR action or

No TWDR action

0

0

1

1

0

0

0

0

1

1

1

1

0

1

0

1

Switched to the not addressed slave mode;
no recognition of own SLA or GCA
Switched to the not addressed slave mode;
own SLA will be recognized;
GCA will be recognized if TWGCE = “1”
Switched to the not addressed slave mode;
no recognition of own SLA or GCA;
a START condition will be transmitted when the bus
becomes free
Switched to the not addressed slave mode;
own SLA will be recognized;
GCA will be recognized if TWGCE = “1”;
a START condition will be transmitted when the bus
becomes free

$C8

Last data byte in TWDR has been
transmitted (TWEA = “0”); ACK
has been received

No TWDR action or

No TWDR action or

No TWDR action or

No TWDR action

0

0

1

1

0

0

0

0

1

1

1

1

0

1

0

1

Switched to the not addressed slave mode;
no recognition of own SLA or GCA
Switched to the not addressed slave mode;
own SLA will be recognized;
GCA will be recognized if TWGCE = “1”
Switched to the not addressed slave mode;
no recognition of own SLA or GCA;
a START condition will be transmitted when the bus
becomes free
Switched to the not addressed slave mode;
own SLA will be recognized;
GCA will be recognized if TWGCE = “1”;
a START condition will be transmitted when the bus
becomes free

S

SLA

R

A

DATA

A

$A8

$B8

A

$B0

Reception of the
own slave address
and one or
more data bytes

Last data byte transmitted.
Switched to not addressed
slave (TWEA = '0')

Arbitration lost as master
and addressed as slave

n

From master to slave

From slave to master

Any number of data bytes
and their associated acknowledge bits

This number (contained in TWSR) corresponds
to a defined state of the 2-Wire Serial Bus. The
prescaler bits are zero or masked to zero

P or S

DATA

$C0

DATA

A

A

$C8

P or S

All 1's

A

Advertising