Mikroelektronika MIKROE-442 Datenbogen
470
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
SPIx_Init_Advanced
Prototype
sub procedure SPIx_Init_Advanced(dim master_mode, mode16, sec_prescaler,
pri_prescaler, slave_select, data_sample, clock_idle, edge as word)
Description Configures and initializes the SPI module with user defined settings.
Parameters Parameters
Parameters Parameters
master_mode
,
mode16
,
sec_prescaler
,
pri_prescaler
,
slave_select
,
data_
sample
,
clock_idle
and determine the working mode for SPI.
The
master_mode
parameter determines the working mode for SPI module.
Master/Slave mode
Description
Predefined library const
Master mode
_SPI_MASTER
Slave mode
_SPI_SLAVE
Data Length Mode
Description
Predefined library const
16-bit mode
_SPI_16_BIT
8-bit mode
_SPI_8_BIT
Secondary SPI Clock Prescaler Value
Description
Predefined library const
Secondary Prescaler 1:1
_SPI_PRESCALE_SEC_1
Secondary Prescaler 1:2
_SPI_PRESCALE_SEC_2
Secondary Prescaler 1:3
_SPI_PRESCALE_SEC_3
Secondary Prescaler 1:4
_SPI_PRESCALE_SEC_4
Secondary Prescaler 1:5
_SPI_PRESCALE_SEC_5
Secondary Prescaler 1:6
_SPI_PRESCALE_SEC_6
Secondary Prescaler 1:7
_SPI_PRESCALE_SEC_7
Secondary Prescaler 1:8
_SPI_PRESCALE_SEC_8
The parameter
mode16
determines the data length mode, which can be 8-bits (per transmitions cycle)
or 16-bits.
The parameter
sec_prescaler
determines the value of the
secondary SPI clock prescaler. Used
only in the Master Mode.
The parameter
pri_prescaler
determines the value of the
primary SPI clock prescaler. Used only
in the Master Mode.
Primary SPI Clock Prescaler Value
Description
Predefined library const
Primary Prescaler 1:1
_SPI_PRESCALE_PRI_1
Primary Prescaler 4:1
_SPI_PRESCALE_PRI_4
Primary Prescaler 16:1
_SPI_PRESCALE_PRI_16
Primary Prescaler 64:1
_SPI_PRESCALE_PRI_64