PIC32MX microcontroller LED blinking C program

The PIC32MX microcontroller are high end 32 bit microcontrollers produced and sold by Microchip.  They are used in embedded system applications. Besides their high speed, they contain number supported peripheral such as USB, CAN etc and many features.

In this PIC32MX microcontroller article, we want to share simple LED blinking program in C programming language. The C program just toggles the LED on and off every second. This is useful for example if you just want to test your PIC32 micrcontroller hardware that you just build. The exact PIC32 microcontroller used here is the PIC32MX470F512L.

To learn PIC 32 bit microcontroller, you can buy and use development boards sold by microchip or others. But here we will use the PIC32 microcontroller break out board onto which the PIC32MX470F512L microcontroller has been assembled. See the picture below.

pic32MX break out board assembly

You can build this at home which do not have to buy one of those expensive development board. One of the main hurdle with doing project with PIC32MX microcontroller is that there is no simple and inexpensive practicing board. Mostly beginners who want to learn PIC 32 bit microcontroller buy development board which is difficult to obtain or expensive. So the board here used was made at home for practicing and working with  PIC32MX470 microcontroller. It is a fairly a simple board where the essential power and ground pins are connected via their capacitors and also you have the ICSP port to program the microcontroller. Also you can see the microcontroller pins expanded to the connecting header pins. There is further a LED that can be connected to any pins you wish.

To start programming the PIC32MX470F512L microcontroller, you need a programmer like PICKIT 3, programming software like MPLAB X IDE and 32 bit compiler for PIC like the XC32. There are many kinds of software, compiler and programmer for PIC microcontroller but here we have used the MPLAB X IDE with XC32 compiler and PICKIT 3.

We assume here that you know how to create project with MPLAB X IDE and that you know how to program a microcontroller using PICKIT 3. If you don’t know how to create a new project simply follow the steps detailed in the tutorial PIC16F877A LED Blinking Project but replace PIC16F877A with PIC32MX470F512L microcontroller.

Then in the main.c file write the following C program.

This code toggles the LED connected to port F pin 2 ON and OFF every second. This is simplest C program code example for PIC 32 microcontroller. In it we first have configured the microcontroller configuration bits- disabling the watchdog timer, disabling the code protection, the brownout, disabling JTAG, configuring the clock etc.

More complicated application can be build with PIC32 microcontrollers. For more complicated application it is usually better to utilize the MPLAB Harmony framework. See PIC32MX MPLAB Harmony Tutorial to learn how to use the framework.

 

What do you think?

0 points
Upvote Downvote

Total votes: 0

Upvotes: 0

Upvotes percentage: 0.000000%

Downvotes: 0

Downvotes percentage: 0.000000%

Leave a Reply

Your email address will not be published. Required fields are marked *

PIC32MX MPLAB Harmony Tutorial

PIC32MX MPLAB Harmony Tutorial

PIC32 microcontroller USART communication via USB

PIC32 UART Interrupt example Project using MPLAB Harmony