Rainbow-electronics ATmega163L Manual do Utilizador Página 84

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 156
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 83
ATmega163(L)
84
in r16, TWSR ; Check value of TWI Status Register. If status
cpi r16, SR_DATA_NACK ; different from SR_DATA_NACK, go to ERROR
brne ERROR
in r16, TWDR ; Input received data from TWDR.
nop ;<do something with received data>
ldi r16, (1<<TWINT) | (1<<TWEA) | (1<<TWEN)
out TWCR, r16 ; Clear TWINT bit in TWCR to start reception of data.
; Setting TWEA causes TWI unit to enter
; not addressed slave mode with reckognition of own SLA
;<Wait for next data transmission or do something else>
Table 35. Status Codes for Slave Transmitter Mode
Status code
(TWSR)
Status of the 2-wire Serial Bus
and 2-wire Serial Interface hard-
ware
Application software response
Next action taken by 2-wire Serial Interface hardware
To/from TWDR
To TWCR
STA STO TWIN
T
TWE
A
$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
Vista de página 83
1 2 ... 79 80 81 82 83 84 85 86 87 88 89 ... 155 156

Comentários a estes Manuais

Sem comentários