Datasheet

SPI1_Read
SPI1_Write
376
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL 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_TRAILING);
Prototype
function SPI1_Read(buffer: byte): byte;
Returns Received data.
Description
Reads one byte from the SPI bus.
Parameters :
-
buffer: dummy data for clock generation (see device Datasheet for SPI mod
ules 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
var take, dummy1 : byte ;
...
take := SPI1_Read(dummy1);
Prototype
procedure SPI1_Write(wrdata: 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.
Example
// write a byte to the SPI bus
var buffer : byte;
...
SPI1_Write(buffer);