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

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
SS Pin Functionality
66
ATmega163(L)
the opposite direction, simultaneously. During one shift cycle, data in the Master and the
Slave is interchanged.
Figure 42. SPI Master-Slave Interconnection
The system is single buffered in the transmit direction and double buffered in the receive
direction. This means that bytes to be transmitted cannot be written to the SPI Data
Register before the entire shift cycle is completed. When receiving data, however, a
received character must be read from the SPI Data Register before the next character
has been completely shifted in. Otherwise, the first byte is lost.
When the SPI is enabled, the data direction of the MOSI, MISO, SCK, and SS pins is
overridden according to Table 25.
Table 25. SPI Pin Overrides
Note:
When the SPI is configured as a Master (MSTR in SPCR is set), the user can determine
the direction of the SS pin. If SS is configured as an output, the pin is a general output
pin which does not affect the SPI system. If SS is configured as an input, it must be held
high to ensure Master SPI operation. If the SS pin is driven low by peripheral circuitry
when the SPI is configured as a Master with the SS pin defined as an input, the SPI sys-
tem interprets this as another Master selecting the SPI as a Slave and starting to send
data to it. To avoid bus contention, the SPI system takes the following actions:
1. The MSTR bit in SPCR is cleared and the SPI system becomes a Slave. As a
2. The SPIF Flag in SPSR is set, and if the SPI interrupt is enabled, and the I-bit in
Thus, when interrupt-driven SPI transmission is used in Master mode, and there exists a
possibility that SS is driven low, the interrupt should always check that the MSTR bit is
still set. If the MSTR bit has been cleared by a slave select, it must be set by the user to
re-enable SPI Master mode.
MOSI
MISO
result of the SPI becoming a Slave, the MOSI and SCK pins become inputs.
SREG is set, the interrupt routine will be executed.
SCK
Pin
SS
1. See “Alternate Functions Of PORTB” on page 118 for a detailed description of how to
define the direction of the user defined SPI pins.
Direction, Master SPI
User Defined
Input
User Defined
User Defined
(1)
User Defined
Direction, Slave SPI
Input
Input
Input
1142E–AVR–02/03

Related parts for ATMEGA163