Setting up In-Circuit Serial Programming for PIC

Objectives

In this tutorial, you will learn how to program a PIC using in-circuit serial programming with the MPLAB® Snap debugger/programmer. This will be critical for your semester project as you will be working with a surface mount microcontroller that cannot be easily removed for offboard programming and does not have a USB port.

At the end of this tutorial you will be able to:

  1. Program a microcontroller in-system on a breadboard using an external programmer.

Bill of Materials

Item Description
In-circuit debugger/programmer MPLAB® Snap
(3-D printable enclosure)
PIC 18F47Q10 microcontroller Part Website (datasheet)
Voltage Regulator Can use either the adjustable regulators located at the lab benches, or one on your breadboard. Set to 3.3V
Breadboard
Resistors Various, as described in the datasheets below
Capacitors Various, as describedin the datasheets below
Jumper wires
Micro USB cable
Male to male header

Resources

Prior to Demonstration of Proficiency

  1. Read and search the MPLAB® Snap In-Circuit Debugger User’s Guide to find answers to the following questions:

    1. How does In-Circuit Serial Programming work with the MPLAB® Snap In-Circuit Debugger?
    2. What circuitry is necessary to connect a PIC to the Snap?
    3. What is the pinout for the 8-pin SIL (single in-line) programming connector used to connect your circuit to the Snap? Note that pin 1 is marked by a black triangle.
  2. Read and search the Pin Diagrams and ICSP™ sections of the PIC18F47Q10 Datasheet to find answers to the following questions:

    1. How does In-Circuit Serial Programming work on the PIC18F47Q10?
    2. Which pins on the PIC18F47Q10-I/P must be connected in order for ICSP™ to work?
  3. Set the BK Precision DC power supply to output 3.3V. Then, turn off the power supply before connecting it to your circuit.

  4. Wire up your breadboard to connect the Snap and the PIC18F47Q10-I/P according to what you learned above. Make sure to connect all of the VDD and VSS pins in addition to the external 3.3V power supply. Whenever there is conflicting hardware configuration information between the Snap manual and the PIC18F47Q10 datasheet, follow the PIC datasheet as every PIC is a bit different and the Snap works with a number of different PICs.

    Tip: If you attach an 8-pin male to male header to your breadboard (or PCB) then it makes it easier to quickly connect and disconnect the Snap from your circuit. |

  5. Launch MPLAB® X and create a new project. Set it up for use with the 18F47Q10 DIP version

    Note: Other tutorials provide more detail regarding project setup.

  1. Compile the project and fix any errors.
  2. Turn on the external power supply and connect the Snap to your computer.
  3. Download your code to the microcontroller. You should see the LED blinking on and off. If this step doesn’t work, debug by first checking all connections against the data sheet, looking for error messages in the IDE, and searching for the error messages on Google. Also see the MPLAB® Snap Troubleshooting Guide for more information.