Mikroelektronika MIKROE-350 Fiche De Données
SPI1_Read
SPI1_Write
364
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub function SPI1_Read(dim buffer as byte) as byte
Returns
Received data.
Description
Reads one byte from the SPI bus.
Parameters :
-
buffer:
dummy data for clock generation (see device Datasheet for SPI
modules implementation details)
Requires
SPI module must be initialized before using this function. See SPI1_Init and
SPI1_Init_Advanced routines.
SPI1_Init_Advanced routines.
Example
' read a byte from the SPI bus
dim take, dummy1 as byte
...
take = SPI1_Read(dummy1)
dim take, dummy1 as byte
...
take = SPI1_Read(dummy1)
Prototype
sub procedure SPI1_Write(dim wrdata as byte)
Returns
Nothing.
Description
Writes byte via the SPI bus.
Parameters :
-
wrdata:
data to be sent
Requires
SPI module must be initialized before using this function. See SPI1_Init and
SPI1_Init_Advanced routines.
SPI1_Init_Advanced routines.
Example
' write a byte to the SPI bus
dim buffer as byte
...
dim buffer as byte
...
SPI1_Write(buffer)