This tutorial is currently under construction.
The following is geared for the 18F4520. This tutorial will also work with the 18F452 and the 18F4525. Before continuing, be sure to read through the first tutorial in this series, PIC Programming Basics
In this tutorial, an in depth explanation of SPI communication on PIC18 series microcontrollers is given. Both master and slave modes of operation will be discussed along with practical considerations which must be taken into account when implementing either. Though the c18 compiler will be used in this tutorial, a low level approach in which registers are modified directly will be taken as opposed to using existing functions in the c18 library. This is done so that the reader is provided with an unobstructed view of the PIC18 hardware and is there for able to see on a register by register basis exactly what is going on “behind the scenes”.