User manual

Table Of Contents
mikroC PRO for PIC32
MikroElektronika
437
SPIx_Read
SPIx_Write
Prototype
unsigned SPIx_Read(unsigned long buffer);
Description Reads one word or byte (depending on mode set by init routines) from the SPI bus.
Parameters - data_out: dummy data for clock generation (see device Datasheet for SPI modules implementation
details)
Returns Received data.
Requires Routine requires at least one SPI module.
Used SPI module must be initialized before using this function. See the SPIx_Init and SPIx_Init_
Advanced routines.
Example
// read a byte from the SPI bus
char take, buffer;
...
take = SPI1_Read(buffer);
Notes SPI library routines require you to specify the module you want to use. To select the desired SPI
module, simply change the letter x in the routine prototype for a number from 1 to 3.
Number of SPI modules per MCU differs from chip to chip. Please, read the appropriate datasheet
before utilizing this library.
Prototype
void SPIx_Write(unsigned long data_out);
Description Writes one word or byte (depending on mode set by init routines) via the SPI bus.
Parameters - data_out: data to be sent
Returns Nothing.
Requires Routine requires at least one SPI module.
Used SPI module must be initialized before using this function. See the SPIx_Init and SPIx_Init_
Advanced routines.
Example
// write a byte to the SPI bus
char buffer;
...
SPI1_Write(buffer);
Notes SPI library routines require you to specify the module you want to use. To select the desired SPI
module, simply change the letter x in the routine prototype for a number from 1 to 3.
Number of SPI modules per MCU differs from chip to chip. Please, read the appropriate datasheet
before utilizing this library.