PIC32MX MPLAB Harmony Tutorial

A Tutorial on MPLAB Harmony, PIC32MX470F512L microcontroller, ADC with interrupt application.

Microchip offers 32 bit microcontrollers for embedded system applications. There are many 32 bit microcontrollers but the high end microcontrollers are the PIC32MX and PIC32MZ microcontrollers. The PIC32MX470F512L is one of the 32 bit microcontroller of the PIC32MX microchip microcontroller family. It has many feature and is used as demonstration of 32 bit micrcontrollers in many microchip product solution for bluetooth, USB etc in development board. In this PIC32MX MPLAB Harmony Tutorial, we show you how to use the Harmony framework to use the ADC with interrupt feature in the PIC32MX470F512L microcontroller. This tutorial can also be found in the Microchip developer guide. But the difference between that and this tutorial is that, in that microchop developer tutorial, the chipKIT™ WF32™ Board is used. In this tutorial we use a self assembled break out board on which the PIC32MX470F512L is assembled. The reason is that you wonbuy board like the chipKIT™ WF32™ Board or you just want to start with bare starting point by buying the 32bit microcontroller chip, create hardware assembly board and start programming it. This is the way it is done here.The PIC32MX470F512L board that is used in this tutorial is shown below. pic32MX break out board assembly

The board is a simple break out board for the PIC32MX470F512L or any 32 bit PIC microcontroller. It has the ICSP programming pins which is later used to program the microcontroller using PICKIT 3.

Video demonstration of PIC32MX MPLAB Harmony Tutorial

Before you start reading this tutorial, perhaps it is better if you looked at the following video to know what this project is doing and what to expect from this tutorial.

Brief Explanation of the PIC32MX MPLAB Harmony Tutorial

Here we want to explain you briefly what we want to do in this tutorial. Before programming the microcontroller, we have first to write the program and to write the program you should be clear what the program should do. The program will read in external signal using the 10 bit ADC inside the microcontroller. The external signal source can be anything but for simplicity we will use a Potentiometer. You can use a 10KOhm or 100KOhm potentiometer. The signal is read in and once the number of signal samples is 16, an interrupt will be generated by the ADC driver. This causes the ISR(Interrupt Service Routine) will be executed. The ISR function will do two things. First, it will average the 16 sampled signal value and generate averaged value and also generate a flag called dataReady. This dataReady flag is used to update the LED status. Now there are 4 LEDs connected to Port G pin 6,7,8 and 9 which corresponds to actual pin number 10, 11, 12 and 14(note not 13 because it is a _MCLR pin). These LEDs are used to indicate the voltage level read from the potentiometer. At the lowest level voltage, only one LED conected to Port G pin 6(RG6) is turned on. As we increase the voltage level, two LEDs, then three LEDs and finally all four LEDs will turn on. The following picture shows the Potentiometer and the four LEDs on the breadboard that are connected to the PIC32 microcontroller. PIC32MX MPLAB Harmony Tutorial

Creating the MPLAB Harmony Project

To start with, first we have to create a new Harmony project. In the MPLAB IDE, click on the New > Project, then you will see the following window. If you click next, you will see option to select Name and Location for your project as shown in the figure below. It has to be saved in a new project folder like ADC_TEST inside C:\microchip\harmony\v1_11\apps. So that your project folder with all files will be located in C:\microchip\harmony\v1_11\apps\ADC_Test. Then Configuration Name can be left in default. In the Device Family select, PIC32MX and select PIC32MX470F512L as your device. After selecting Name and Location click Finish. At this point your project will be created- project folder directory structure(Header Files, Important Files…) will be created. And simultaneously, the MPLAB Harmony Configurator(MHC) will be launched. Note that you have to first install MPLAB IDE and then install the MHC plugin from the Tool menu at the toolbar in the IDE. Otherwise you won’t be able to launch the MHC.  

What do you think?

0 points
Upvote Downvote

Total votes: 0

Upvotes: 0

Upvotes percentage: 0.000000%

Downvotes: 0

Downvotes percentage: 0.000000%

What is Static and Dynamic Implementation in MPLAB Harmony

pic32MX break out board assembly

PIC32MX microcontroller LED blinking C program