Assembly code example - master transmitter mode, Figure 52, In figure 52 t – Rainbow Electronics ATmega163L User Manual
Page 76: Ee figure 52), Table 52, Atmega163(l)

ATmega163(L)
76
Figure 52. Formats and States in the Master Transmitter Mode
Assembly Code Example - Master Transmitter Mode
;The slave being addressed has address 0x64. The code examples also assumes some sort of error handling
routine named ERROR.
;Part specific include file and TWI include file must be included.
;
ldi
r16, (1< out TWCR, r16 ; Send START condition wait1: in r16,TWCR ; Wait for TWINT flag set. This indicates that sbrs r16,TWINT ; the START condition has been transmitted S SLA W A DATA A P $08 $18 $28 S 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 MT MR Successfull Next transfer Not acknowledge Not acknowledge Arbitration lost in slave Arbitration lost and DATA A n From master to slave From slave to master Any number of data bytes This number (contained in TWSR) corresponds
states in slave mode
transmission
to a slave
receiver
started with a
repeated start
condition
received after the
slave address
received after a data
byte
address or data byte
addressed as slave
and their associated acknowledge bits
to a defined state of the 2-Wire Serial Bus