3.5. PIC16 C SPI Serial Bus

• SPI system connections

• SPI function set

• SPI test system

The serial peripheral interface master controller uses hardware slave selection to identify a peripheral device with which it wishes to exchange data (refer to Section 1.4 for full details of the signaling protocol). The available set of SPI driver functions are shown in Table 3.7

Table 3.7. SPI Function Set
OperationDescriptionExample
SPI SETUPInitializes SPI serial portsetup_spi(spi_master);
SPI READReceives data byte from SPI portinbyte=spi_read();
SPI WRITESends data byte via SPI portspi_write(outbyte);
SPI TRANSFERSends and receives via SPIinbyte=spi_xfer(outbyte);
SPI RECEIVEDChecks if SPI data receiveddone=spi_data_is_in();
.

The test system has a slave transmitter ...

Get Programming 8-bit PIC Microcontrollers in C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.