ATMEGA169 ATMEL [ATMEL Corporation], ATMEGA169 Datasheet - Page 182

no-image

ATMEGA169

Manufacturer Part Number
ATMEGA169
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:
ATMEGA169-16AI
Manufacturer:
Atmel
Quantity:
10 000
Part Number:
ATMEGA169-16AI SL709
Manufacturer:
Atmel
Quantity:
10 000
Part Number:
ATMEGA169-16AI SL710
Manufacturer:
Atmel
Quantity:
10 000
Part Number:
ATMEGA169-16AU
Manufacturer:
Atmel
Quantity:
10 000
Part Number:
ATMEGA169A-AU
Manufacturer:
Atmel
Quantity:
10 000
Part Number:
ATMEGA169P-15AT
Manufacturer:
PANASONIC
Quantity:
301
Part Number:
ATMEGA169P-15AT
Manufacturer:
ATMEL/爱特梅尔
Quantity:
20 000
Part Number:
ATMEGA169P-16AU
Manufacturer:
ATMEL/爱特梅尔
Quantity:
20 000
Part Number:
ATMEGA169PA-MU
Manufacturer:
ATMEL
Quantity:
31
Part Number:
ATMEGA169PAAU
Manufacturer:
INF
Quantity:
4 275
SPI Slave Operation Example
182
ATmega169/V
The following code demonstrates how to use the USI module as a SPI Master with max-
imum speed (fsck = fck/4):
The following code demonstrates how to use the USI module as a SPI Slave:
The code is size optimized using only eight instructions (+ ret). The code example
assumes that the DO is configured as output and USCK pin is configured as input in the
DDR Register. The value stored in register r16 prior to the function is called is trans-
ferred to the master device, and when the transfer is completed the data received from
the Master is stored back into the r16 Register.
SPITransfer_Fast:
ret
init:
...
SlaveSPITransfer:
SlaveSPITransfer_loop:
sts
ldi
ldi
sts
sts
sts
sts
sts
sts
sts
sts
sts
sts
sts
sts
sts
sts
sts
sts
lds
ldi
sts
sts
ldi
sts
lds
sbrs
rjmp
lds
ret
USIDR,r16
r16,(1<<USIWM0)|(0<<USICS0)|(1<<USITC)
r17,(1<<USIWM0)|(0<<USICS0)|(1<<USITC)|(1<<USICLK)
USICR,r16 ; MSB
USICR,r17
USICR,r16
USICR,r17
USICR,r16
USICR,r17
USICR,r16
USICR,r17
USICR,r16
USICR,r17
USICR,r16
USICR,r17
USICR,r16
USICR,r17
USICR,r16 ; LSB
USICR,r17
r16,USIDR
r16,(1<<USIWM0)|(1<<USICS1)
USICR,r16
USIDR,r16
r16,(1<<USIOIF)
USISR,r16
r16, USISR
r16, USIOIF
SlaveSPITransfer_loop
r16,USIDR
2514P–AVR–07/06

Related parts for ATMEGA169