Download mikroPascal PRO - MikroElektronika

Transcript
mikoPascal PRO for dsPIC30/33 and PIC24
SPIx_Init_Advanced
Prototype
procedure SPIx_Init_Advanced(master_mode, mode16, sec_prescaler,
prescaler, slave_select, data_sample, clock_idle, edge: word);
pri_
Description Configures and initializes the SPI module with user defined settings.
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
The parameter mode16 determines the data length mode, which can be 8-bits (per transmitions cycle)
or 16-bits.
Data Length Mode
Description
Predefined library const
16-bit mode
_SPI_16_BIT
8-bit mode
_SPI_8_BIT
The parameter sec_prescaler determines the value of the secondary SPI clock prescaler. Used
only in the Master Mode.
Secondary SPI Clock Prescaler Value
Description
Predefined library const
Secondary Prescaler 1:1
_SPI_PRESCALE_SEC_1
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
Secondary Prescaler 1:2
_SPI_PRESCALE_SEC_2
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 16:1
_SPI_PRESCALE_PRI_16
Primary Prescaler 64:1
_SPI_PRESCALE_PRI_64
Primary Prescaler 4:1
MikroElektronika
_SPI_PRESCALE_PRI_4
469