User manual

Table Of Contents
434
mikoC PRO for PIC32
MikroElektronika
SPIx_Init
Prototype
void SPIx_Init();
Description Congures and initializes the SPI module with default settings.
Default settings:
- Master mode.
- 8-bit data mode.
- Serial clock set to System clock/64.
- Slave Select disabled.
- Input data sampled in the middle of interval.
- Clock idle state low.
- Serial output data changes on transition from idle clock state to active clock state
Parameters None.
Returns Nothing.
Requires MCU must have the SPI1 module.
Example
// Initialize the SPI1 module with default settings
SPI1_Init();
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.
Switching between the SPI modules in the SPI library is done by the SPI_Set_Active function (both
SPI modules have to be previously initialized).