Mikroelektronika MIKROE-724 データシート

ページ / 726
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
469
SPIx_Init
Prototype
sub procedure SPIx_Init()
Description Configures and initializes the SPI module with default settings.
Default settings: 
- Master mode 
- 8-bit data mode 
- secondary prescaler 1:1 
- primary prescaler 64:1 
- Slave Select disabled 
- input data sampled in the middle of interval 
- clock idle state low 
- Serial output data changes on transition from active clock state to idle 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).