ATmega48PA Automotive Atmel Corporation, ATmega48PA Automotive Datasheet - Page 125
![no-image](/images/manufacturer_photos/0/0/79/atmel_corporation_sml.jpg)
ATmega48PA Automotive
Manufacturer Part Number
ATmega48PA Automotive
Description
Manufacturer
Atmel Corporation
- Current page: 125 of 225
- Download datasheet (4Mb)
16.3.2
7701E–AVR–02/11
SPI Master Operation Example
The following code demonstrates how to use the USI module as a SPI Master:
The code is size optimized using only eight instructions (+ ret). The code example assumes
that the DO and USCK pins are enabled as output in the DDRE register. The value stored in
register r16 prior to the function being called is transferred to the slave device, and when the
transfer is completed, the data received from the slave is stored back into the r16 register.
The second and third instructions clear the USI counter overflow flag and the USI counter
value. The fourth and fifth instructions set the three-wire mode, positive edge shift register
clock, count at USITC strobe, and toggle USCK. The loop is repeated 16 times.
The following code demonstrates how to use the USI module as an SPI master with maximum
speed (f
SPITransfer:
SPITransfer_loop:
SPITransfer_Fast:
out
ldi
out
ldi
out
in
sbrs
rjmp
in
ret
out
ldi
ldi
out
out
out
out
out
out
out
out
out
out
out
out
out
out
out
sck
= f
ck
/4):
USIDR,r16
r16,(1<<USIOIF)
USISR,r16
r16,(1<<USIWM0)|(1<<USICS1)|(1<<USICLK)|(1<<USITC)
USICR,r16
r16, USISR
r16, USIOIF
SPITransfer_loop
r16,USIDR
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
Atmel ATtiny24/44/84 [Preliminary]
125
Related parts for ATmega48PA Automotive
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
![ATmega48PA](/images/manufacturer_photos/0/0/79/atmel_corporation_tmb.jpg)
Part Number:
Description:
Manufacturer:
Atmel Corporation
Datasheet:
![ATMEGA48PA-15MZ](/images/manufacturer_photos/0/0/79/atmel_corporation_tmb.jpg)
Part Number:
Description:
Manufacturer:
ATMEL Corporation
Datasheet:
![ATMEGA48P-20MU](/photos/12/13/121314/atmega48p-20mu_tmb.jpg)
Part Number:
Description:
MCU AVR 4K ISP FLASH 20MHZ 32QFN
Manufacturer:
Atmel
Datasheet:
![ATmega48P](/images/manufacturer_photos/0/0/79/atmel_corporation_tmb.jpg)
Part Number:
Description:
Manufacturer:
Atmel Corporation
Datasheet:
![ATMEGA48P-20AU](/photos/6/91/69154/313-32-tqfp_tmb.jpg)
Part Number:
Description:
MCU AVR 4K ISP FLSH 20MHZ 32TQFP
Manufacturer:
Atmel
Datasheet:
![ATMEGA48P-20PU](/photos/7/21/72189/453-28-dip_tmb.jpg)
Part Number:
Description:
MCU AVR 4K ISP FLASH 20MHZ 28DIP
Manufacturer:
Atmel
Datasheet:
![ATMEGA48P-20AUR](/photos/6/91/69154/313-32-tqfp_tmb.jpg)
Part Number:
Description:
MCU AVR 4K FLASH 20MHZ 32TQFP
Manufacturer:
Atmel
Datasheet:
![ATMEGA48P-20MUR](/images/manufacturer_photos/0/0/78/atmel_tmb.jpg)
Part Number:
Description:
MCU AVR 4K FLASH 20MHZ 32QFN
Manufacturer:
Atmel
Datasheet:
![ATMEGA48P-20MMU](/photos/12/32/123209/28m1-vqfn_tmb.jpg)
Part Number:
Description:
MCU AVR 4K FLASH 20MHZ 28-QFN
Manufacturer:
Atmel
Datasheet:
![ATMEGA48P-20MMUR](/photos/12/32/123209/28m1-vqfn_tmb.jpg)
Part Number:
Description:
MCU AVR 4K FLASH 20MHZ 28QFN
Manufacturer:
Atmel
Datasheet:
![U641B](/images/manufacturer_photos/0/0/79/atmel_corporation_tmb.jpg)
Part Number:
Description:
INTERVAL AND WIPE/WASH WIPER CONTROL IC WITH DELAY
Manufacturer:
ATMEL Corporation
Datasheet:
![U4082B](/images/manufacturer_photos/0/0/79/atmel_corporation_tmb.jpg)
Part Number:
Description:
Low-Voltage Voice-Switched IC for Hands-Free Operation
Manufacturer:
ATMEL Corporation
Datasheet: