Microchip | The Embedded Control Solutions Company Register Login
Browse All
Microchip Technology
 305 Code Snippets

CE141 - SPI module running in different modes

Microchip Technology

This code shows an example of running the SPI module in different modes. The first mode is for outputting to a single device which requires a Framed SPI mode.

About this Code Example

1. Code Example Description:
----------------------------
This code shows an example of running the SPI module in different modes.  The first mode is for outputting to a
single device which requires a Framed SPI mode. 

Slave Select ----|                      |-----------------
         |________________________________|

SCLK   xxxxxxxxxx |-| |-| |-| |-| |-| |-| |-| |-| xxxxxxxxxx
       xxxxxxxxxx_| |_| |_| |_| |_| |_| |_| |_| |_xxxxxxxxxx

SDA    xxxxxxxxxx d7  d6  d5  d4  d3  d2  d1  d0  xxxxxxxxxx
      

The second example is for a device which can accept a string of clocks,
but will only respond to the byte after the frame bit.

Slave Select  |--|                    
        __|     |__________________________________________

SCLK    |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| |-| xxxxxxxxxx
       _| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_xxxxxxxxxx

SDA    xxxxxxxxxx   d7  d6  d5  d4  d3  d2  d1  d0  xxxxxxxxxx
      
The code also goes through the 4 combinations of CKP and CKE.

Categories

Release History

  • Apr 19, 2012

    Version: 1.0.0

    New

Download Contact the Developer

*Required Fields

  • Current Version:1.0.0
  • Created:Apr 19, 2012
  • Updated:Feb 26, 2015
  • Downloads:2706
  • MPLAB Version:v8.xx or higher
  • C Compiler:c30 v3.xx or higher
  • Development Tools:Explorer 16
  • Supported Devices:dsPIC33Fxxxx

Corporate News

Resources

Stay Connected

Stay up to date with the latest news from Microchip Technology.