ATTINY26L8SU SL383 Atmel, ATTINY26L8SU SL383 Datasheet - Page 89

no-image

ATTINY26L8SU SL383

Manufacturer Part Number
ATTINY26L8SU SL383
Description
MCU 8-Bit ATtiny AVR RISC 2KB Flash 3.3V/5V 20-Pin SOIC T/R
Manufacturer
Atmel
Datasheet
SPI Slave Operation Example
1477J–AVR–06/07
The following code demonstrates how to use the USI module as a SPI Master with max-
imum speed (fsck = fck/2):
The following code demonstrates how to use the USI module as a SPI slave:
The code is size optimized using only 8 instructions (+ ret). The code example assumes
that the DO is configured as output and SCK pin is configured as input in the DDRB
Register. The value stored in register r16 prior to the function is called is transferred to
SPITransfer_Fast:
ret
init:
...
SlaveSPITransfer:
SlaveSPITransfer_loop:
out
ldi
ldi
out
out
out
out
out
out
out
out
out
out
out
out
out
out
out
out
in
ldi
out
out
ldi
out
sbis
rjmp
in
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
USISR,USIOIF
SlaveSPITransfer_loop
r16,USIDR
ATtiny26(L)
89

Related parts for ATTINY26L8SU SL383