Getting Started with SPI Using MSSP on PIC18
■The approach in implementing the SPI communication protocol is different among the PIC18F device family of microcontrollers. While the PIC18-K40 and PIC18-Q10 product families have a Master Synchronous Serial Port (MSSP) peripheral, the PIC18-K42, PIC18-K83, PIC18-Q41, PIC18-Q43 and PIC18-Q84 product families have a dedicated Serial Peripheral Interface (SPI) peripheral.
■Both peripherals are serial interfaces useful for communicating with other peripherals or microcontroller devices, but there are also differences between them. The MSSP peripheral can operate in one of two modes: Serial Peripheral Interface (SPI) and Inter-Integrated Circuit (I²C), which allows the advantage of implementing both communication protocols with the same hardware. The dedicated SPI peripheral works similarly to the MSSP, and has more features, such as Receive Only and Transmit Only modes, Double Buffering and Receive and Transmit FIFO.
■This technical brief provides information about MSSP on the PIC18-K40 and PIC18-Q10 product families and intends to familiarize the user with PIC® microcontrollers.
■The document describes the application area, the modes of operation and the hardware and software requirements of the MSSP module configured in SPI mode.
■Throughout the document, the configuration of the peripheral will be described in detail, starting with the location of the SPI pins, the direction of the pins, how to initialize the device as a master or a slave and how to exchange data inside the system. This document covers the following use cases:
▲ Sending Data as a Master SPI Device with Multiple Slaves:
◆This example shows how to configure the device as a master to control two slave devices and to send data using the polling method.
▲ Receiving Data as a Slave SPI Device:
◆This example shows how to configure the device as a slave that will wait for the incoming data using the polling method.
▲Exchanging Data as a Slave SPI Device Using Interrupts:
◆This example shows how to configure the device as a slave that will wait for the incoming data. In this case, the data transmission/reception will be triggered by interrupts.
▲Changing Data Transfer Type:
◆This example shows how to configure the device as a master that will send data with respect to the clock polarity and the clock edge.
PIC18 、 PIC18F 、 PIC18-K42 、 PIC18-K83 、 PIC18-Q41 、 PIC18-Q43 、 PIC18-Q84 |
|
|
|
Application note & Design Guide |
|
|
|
Please see the document for details |
|
|
|
|
|
|
|
English Chinese Chinese and English Japanese |
|
10/2020 |
|
Rev B |
|
TB3265;DS90003265B |
|
576 KB |
- +1 Like
- Add to Favorites
Recommend
All reproduced articles on this site are for the purpose of conveying more information and clearly indicate the source. If media or individuals who do not want to be reproduced can contact us, which will be deleted.