Datasheet
SPI1_Read
SPI1_Write
428
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6
Requires MCU must have SPI module.
Example
// Set SPI to the Master Mode, clock = Fosc/32 , clock idle level
is high, data sampled on falling edge:
SPI1_Init_Advanced(_SPI_MASTER, _SPI_FCY_DIV32, _SPI_CLK_HI_TRAIL-
ING);
Prototype
char SPI1_Read(char buffer);
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.
Example
// read a byte from the SPI bus
char take, dummy1;
...
take = SPI1_Read(dummy1);
Prototype
void SPI1_Write(char data_out);
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.
Example
// write a byte to the SPI bus
char buffer;
...
SPI1_Write(buffer);