ATA6602-EK Atmel, ATA6602-EK Datasheet - Page 186
![no-image](/images/manufacturer_photos/0/0/78/atmel_sml.jpg)
ATA6602-EK
Manufacturer Part Number
ATA6602-EK
Description
Manufacturer
Atmel
Datasheet
1.ATA6602-EK.pdf
(360 pages)
Specifications of ATA6602-EK
Lead Free Status / Rohs Status
Supplier Unconfirmed
- Current page: 186 of 360
- Download datasheet (6Mb)
186
ATA6602/ATA6603
The following code examples show how to initialize the SPI as a Slave and how to perform a
simple reception.
Note:
Assembly Code Example
C Code Example
SPI_SlaveInit:
SPI_SlaveReceive:
void SPI_SlaveInit(void)
{
}
char SPI_SlaveReceive(void)
{
}
; Set MISO output, all others input
ldi
out
; Enable SPI
ldi
out
ret
; Wait for reception complete
sbis SPSR,SPIF
rjmp SPI_SlaveReceive
; Read received data and return
in
ret
/* Set MISO output, all others input */
DDR_SPI = (1<<DD_MISO);
/* Enable SPI */
SPCR = (1<<SPE);
/* Wait for reception complete */
while(!(SPSR & (1<<SPIF)))
/* Return Data Register */
return SPDR;
1. The example code assumes that the part specific header file is included.
;
r17,(1<<DD_MISO)
DDR_SPI,r17
r17,(1<<SPE)
SPCR,r17
r16,SPDR
(1)
(1)
4921E–AUTO–09/09