beautypg.com

Figure 25-12 on, Atmega128rfa1 – Rainbow Electronics ATmega128RFA1 User Manual

Page 389

background image

389


8266A-MCU Wireless-12/09

ATmega128RFA1

TWCR

TWINT

TWEA

TWSTA

TWSTO

TWWC

TWEN

TWIE

Value

1

X

0

0

X

1

0

X

This scheme is repeated until the last byte has been sent and the transfer is ended by
generating a STOP condition or a repeated START condition. A STOP condition is
generated by writing the following value to TWCR:

TWCR

TWINT

TWEA

TWSTA

TWSTO

TWWC

TWEN

TWIE

Value

1

X

0

1

X

1

0

X

A REPEATED START condition is generated by writing the following value to TWCR:

TWCR

TWINT

TWEA

TWSTA

TWSTO

TWWC

TWEN

TWIE

Value

X

1

0

X

1

0

X

After a REPEATED START condition (state 0x10) the 2-wire Serial Interface can
access the same Slave again, or a new Slave without transmitting a STOP condition.
Repeated START enables the Master to switch between Slaves, Master Transmitter
mode and Master Receiver mode without losing control of the bus.

Figure 25-12. Formats and States in the Master Transmitter Mode

S

SLA

W

A

DATA

A

P

$08

$18

$28

R

SLA

W

$10

A

P

$20

P

$30

A or A

$38

A

Other master

continues

A or A

$38

Other master

continues

R

A

$68

Other master

continues

$78

$B0

To corresponding
states in slave mode

MT

MR

Successfull
transmission
to a slave
receiver

Next transfer
started with a
repeated start
condition

Not acknowledge
received after the
slave address

Not acknowledge
received after a data
byte

Arbitration lost in slave
address or data byte

Arbitration lost and
addressed as slave

DATA

A

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 Two-Wire Serial Bus. The
prescaler bits are zero or masked to zero

S