SPI Master / SPI Slave via PIC

Project Info
Author: Chris
Difficulty: Medium
Time Invested: 2 Hours

Prerequisites:
Take a look at the above
tutorials before continuing
to read this tutorial.
           Another widely used serial communication protocol aside from RS232 serial and I2C is called SPI, short for serial peripheral interface. SPI is extremely similar to I2C and infact many SPI devices can also read and write I2C on the same communication lines. SPI interfaces can be found in devices like sensors, motor controllers or virtually anything digital and low speed.
           In this tutorial the two types of SPI devices that exist in the world will be introduced: the SPI Master and the SPI Slave. The SPI Master controls the flow communication on the dataline while SPI Slave waits for contact from the Master before reading or writing data.



SPI Interface Demonstration Video

SPI Interface Setup

Purpose & Overview of this project
           This tutorial will use two PIC 18F452 microcontrollers to create one SPI Master device and one SPI Slave device. The SPI Master should be continuously sending the SPI Slave commands to change the status of an output port. The output port on the slave will consist of 7 LEDs, which should start counting from 255 downto 0, in short, 0.5 second steps.
           To create the SPI interface we will take a look at the SPI hardware already available on the PIC microcontroller and see how to use the C18 libraries to configure and communicate using the hardware SPI module interface.



;