SPI Remappable Library
SPI Remappable module is available with these MCUs: 18F2xJ11, 18F4xJ11, 18F2xJ50 and 18F4xJ50. mikroBasic PRO for PIC provides a library for initializing Slave mode and comfortable work with Master mode. PIC can easily communicate with other devices via SPI: A/D converters, D/A converters, MAX7219, LTC1290, etc.

Library Dependency Tree

Library Routines
SPI_Remappable_Init
Prototype |
sub procedure SPI_Remappable_Init() |
---|---|
Returns |
Nothing. |
Description |
Configures and initializes SPI Remappable module with default settings. Default settings are:
![]() |
Requires |
You'll need PIC MCU with hardware integrated SPI and remappable feature. |
Example |
' Initialize the SPI Remappable module with default settings SPI_Remappable_Init() |
SPI_Remappable_Init_Advanced
Prototype |
sub procedure SPI_Remappable_Init_Advanced(dim mode, data_sample, clock_idle, transmit_edge as byte) |
||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns |
Nothing. |
||||||||||||||||||||||||||||||||||
Description |
Configures and initializes SPI Remappable module. ![]() Parameters
|
||||||||||||||||||||||||||||||||||
Requires |
You need PIC MCU with hardware integrated SPI and remappable feature. |
||||||||||||||||||||||||||||||||||
Example |
' Set SPI to master mode, clock = Fosc/4, data sampled at the middle of interval, clock idle state low and data transmitted at low to high edge: SPI_Remappable_Init_Advanced(_SPI_REMAPPABLE_MASTER_OSC_DIV4, _SPI_REMAPPABLE_DATA_SAMPLE_MIDDLE, _SPI_REMAPPABLE_CLK_IDLE_LOW, _SPI_REMAPPABLE_LOW_2_HIGH) |
SPI_Remappable_Read
Prototype |
sub function SPI_Remappable_Read(dim buffer as byte) as byte |
---|---|
Returns |
Returns the received data. |
Description |
Reads one byte from the SPI bus. Parameters :
|
Requires |
You need PIC MCU with hardware integrated SPI and remappable feature. SPI must be initialized and communication established before using this function. See SPI_Remappable_Init_Advanced or SPI_Remappable_Init. |
Example |
dim buffer, take as byte main : take = SPI_Remappable_Read(buffer) end. |
SPI_Remappable_Write
Prototype |
sub procedure SPI_Remappable_Write(dim data_ as byte) |
---|---|
Returns |
Nothing. |
Description |
Writes byte |
Requires |
You need PIC MCU with hardware integrated SPI and remappable feature. SPI must be initialized and communication established before using this function. See SPI_Remappable_Init_Advanced or SPI_Remappable_Init. |
Example |
SPI_Remappable_Write(1) |
What do you think about this topic ? Send us feedback!