ATMEGA163 ATMEL [ATMEL Corporation], ATMEGA163 Datasheet - Page 96

no-image

ATMEGA163

Manufacturer Part Number
ATMEGA163
Description
8-bit Microcontroller with 16K Bytes In-System Programmable Flash
Manufacturer
ATMEL [ATMEL Corporation]
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
ATMEGA163-8AC
Manufacturer:
ATMEL
Quantity:
1 600
Part Number:
ATMEGA163-8AI
Manufacturer:
ATMEL/爱特梅尔
Quantity:
20 000
Part Number:
ATMEGA163L-4AI
Manufacturer:
ATMEL
Quantity:
984
Assembly Code Example –
Slave Receiver Mode
96
ATmega163(L)
Figure 54. Formats and States in the Slave Receiver Mode
Reception of the Own
Slave Address and One or
More Data Bytes. All are
Acknowledged
Last Data Byte Received
is not Acknowledged
Arbitration Lost as Master
and Addressed as Slave
Reception of the General Call
Address and One or More Data
Bytes
Last Data Byte Received is
not Acknowledged
Arbitration Lost as Master and
Addressed as Slave by General Call
;Part specific include file and TWI include file must be included.
; <Initialize registers TWAR and TWBR>
; <Receive START condition and SLA+W>
wait10:in
ldi
out
sbrs
rjmp
From Master to Slave
From Slave to Master
in
cpi
brne
ldi
out
r16, (1<<TWINT) | (1<<TWEA) | (1<<TWEN)
TWCR, r16
r16,TWCR
r16, TWINT
wait10
r16, TWSR
r16, SR_SLA_ACK ; different from SR_SLA_ACK, go to ERROR
ERROR
r16, (1<<TWINT) | (1<<TWEA) | (1<<TWEN)
TWCR, r16
S
SLA
General Call
; Enable TWI in Slave Receiver Mode
; Wait for TWINT flag set. This indicates that
; START followed by SLA+W has been received
; Check value of TWI Status Register. If status
; Clear TWINT bit in TWCR to start reception of
; first data byte. Setting TWEA indicates that
W
DATA
$60
$68
$70
$78
A
A
A
A
n
A
DATA
DATA
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
$80
$90
A
A
DATA
DATA
1142E–AVR–02/03
$80
$90
$88
$98
A
A
A
A
P or S
P or S
P or S
P or S
$A0
$A0

Related parts for ATMEGA163