Spi library, Mikroc – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 274

Advertising
background image

SPI module is available with a number of PIC MCU models. mikroC 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 convert-
ers, MAX7219, LTC1290, etc. You need PIC MCU with hardware integrated SPI
(for example, PIC16F877).

Note: This library supports module on PORTB or PORTC, and will not work with
modules on other ports. Examples for PICmicros with module on other ports can
be found in your mikroC installation folder, subfolder “Examples”.

Spi_Init

Spi_Init_Advanced

Spi_Read

Spi_Write

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

266

MikroElektronika: Development tools - Books - Compilers

page

SPI Library

Library Routines

Prototype

void

Spi_Init(void);

Description

Configures and initializes SPI with default settings.

SPI_Init_Advanced

or

SPI_Init

needs to be called before using other functions from SPI Library.

Default settings are: Master mode, clock Fosc/4, clock idle state low, data transmitted on
low to high edge, and input data sampled at the middle of interval.

For custom configuration, use

Spi_Init_Advanced

.

Requires

You need PIC MCU with hardware integrated SPI.

Example

Spi_Init();

Spi_Init

Advertising
This manual is related to the following products: