Skip to content

The PIC18F47Q10 features two MSSP modules, which can be configured in SPI mode. In this demo, the SPI is configured as master and it is used to send data to a slave device, in data mode 3. The repository contains the bare metal code for the application.

Notifications You must be signed in to change notification settings

microchip-pic-avr-examples/pic18f47q10-cnano-spi-mode-change-bare

Repository files navigation

MCHP

PIC18F47Q10 Changing Data Transfer Type

Objective

This repository contains an example of bare-metal source code for SPI as described in TB3265 - Getting Started with SPI using MSSP on PIC18 document from Microchip.
In this demo, the SPI will be configured as host and it will be used to send data to a client device, in data mode 3.

Related Documentation

Software Used

Hardware Used

Setup

The PIC18F47Q10 Curiosity Nano Development Board is used as the test platform.


The following configurations must be made for this project:

  • Clock

    • Oscillator Select: HFINTOSC
    • HF Internal Clock: 64 MHz
    • Clock Divider: 1
  • MSSP1:

    • MSSP1 Enabled
    • Serial Protocol: SPI
    • Mode: Master
    • Data Mode: 3
    • Input Data Sampled At: Middle
    • Clock Source Selection: FOSC/4_SSPxADD
    • SPI Clock Frequency: 8 MHz
  • Watchdog Timer: disabled

  • Low-voltage Programming: enabled

Pin Configuration
RC3 (SCK) Digital Output
RC4 (SDI) Digital Input
RC5 (SDO) Digital Output
RC6 (SS) Digital Output

Operation

  1. Connect the board to the PC.

  2. Open the pic18f47q10-cnano-spi-mode-change-bare.X project in MPLAB® X IDE.

  3. Set pic18f47q10-cnano-spi-mode-change-bare.X project as main project. Right click on the project in the Projects tab and click Set as Main Project.

  4. Select the PIC18F47Q10 Curiosity Nano in the Hardware Tool section of the project settings:

  • Right click on the project and click Properties;
  • Select the PIC18F47Q10 Curiosity Nano (click on the SN) in the Hardware Tool tab and then click OK:
  1. Program the project to the board: right click on the project and click Make and Program Device.

Result:

  • Channel 0 -> SCK
  • Channel 1 -> SDI
  • Channel 2 -> SDO
  • Channel 3 -> SS

Summary

This project is an illustration for a basic use case based around MSSP1 in SPI mode.

About

The PIC18F47Q10 features two MSSP modules, which can be configured in SPI mode. In this demo, the SPI is configured as master and it is used to send data to a slave device, in data mode 3. The repository contains the bare metal code for the application.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published