Mikroelektronika MIKROE-738 Datenbogen
![Mikroelektronika](https://files.manualsbrain.com/attachments/e0529b3b58069a916ad7bb89f7e9f5f0eda73421/common/fit/150/50/1b07b99aa3112e022a916b06db07f1f4f211e91d41878452d87c7638b1bf/brand_logo.gif)
mikroC PRO for PIC32
MikroElektronika
421
Software SPI Library
The mikroC PRO for PIC32 provides routines for implementing Software SPI communication. These routines are
hardware independent and can be used with any MCU. The Software SPI Library provides easy communication with
other devices via SPI: A/D converters, D/A converters, MAX7219, LTC1290, etc.
Library configuration:
- SPI to Master mode
- Clock value = 20 kHz.
- Data sampled at the middle of interval.
- Clock idle state low.
- Data sampled at the middle of interval.
- Data transmitted at low to high edge.
The library configures SPI to the master mode, clock = 20kHz, data sampled at the middle of interval, clock idle state
low and data transmitted at low to high edge.
Important : The Software SPI library implements time-based activities, so interrupts need to be disabled when using it.
The following variables must be defined
in all projects using Software SPI
Library:
Description:
Example:
extern sfr sbit SoftSpi_SDI;
Data In line.
sbit SoftSpi_SDI at RF4_bit;
extern sfr sbit SoftSpi_SDO;
Data Out line.
sbit SoftSpi_SDO at LATF3_bit;
extern sfr sbit SoftSpi_CLK;
Clock line.
sbit SoftSpi_CLK at LATF6_bit;
extern sfr sbit SoftSpi_SDI_
Direction;
Direction of the Data In pin.
sbit SoftSpi_SDI_Direction at TRISF4_
bit;
extern sfr sbit SoftSpi_SDO_
Direction;
Direction of the Data Out pin
sbit SoftSpi_SDO_Direction at TRISF3_
bit;
extern sfr sbit SoftSpi_CLK_
Direction;
Direction of the Clock pin.
sbit SoftSpi_CLK_Direction at TRISF6_
bit;
External dependencies of Software SPI Library
Library Routines
- Soft_SPI_Init
- Soft_SPI_Read
- Soft_SPI_Write