MPLAB Xpress – First MPLAB Xpress IDE project

Where we left off before,  we were just about ready to try out the new MPLAB Xpress IDE. In order to do that, you need to open up your favorite browser and go to the following address: Microchip site.

 

Gest Mode and Registering

 

When you land on this page you are presented with the MPLAB Xpress IDE which looks almost identical to the MPLAB X IDE all through your web browser. The one thing I liked to see right off the bat was that there was no login or register window forcing registration before you can do anything.

 

mplab xpress ide guest

 

Instead you are given almost full access to the IDE in guest mode. From what I can tell it means you can’t save your work to the cloud, but you can still export your work. Clicking myMicrochip Login will get you registered to use all features of the IDE.

 

mplab xpress ide logged in

 

 

Projects in MPLAB Xpress IDE

 

Now that we are logged in and staring at the blank MPLAB Xpress IDE it is time to start a project. I decided to start off with an existing example project as a first test. A first test usually starts with some sort of ‘hello world’ program. Since we have a few LEDs to work with and a 1-turn pot connected to an ADC pin we will choose a example project that will use the pot as a dimmer for our on-board LEDs.

 

mplab xpress ide example projects

 

Click File -> New Project -> Microchip Examples

One of the example projects is “LED Brightness Control using Potentiometer”.

Selecting that,’next’ brings you to a screen where you are prompted to select a target device you wish to write your code for. In our case the MPLAB Xpress dev board has a PIC16F18855 onboard. From there you are prompted to name your project and you are brought back into the IDE.

 

mplab xpress ide new project window

 

You will see the example project now open in your IDE. A source file ‘main.c’ will be open containing the below code. The project is very simple if you strip away all the comments and comment headers. Ignoring the include file and init function that is called at the beginning, which is a result of auto generated code from using the Code Configurator by the author of this example, all that exists is a while loop.

 

 

In this loop there is a call to read the ADC pin attached to the pot. This read value is then used to pass to PWM6 which is controlling the onboard LEDs. That’s it, two lines of code.

 

Compiling and Uploading Your Project

 

So lets see what this does on the Xpress board. Clicking the hammer icon ‘build’ which compiles the project and if successful results in the IDE triggering a download of the .hex file needed to upload to the microcontroller. No fancy programmer needed to push this to the board, the Xpress board enumerates as a USB Mass Storage device on your PC and the secondary micro on this board (the programmer) just sits waiting for a .hex file to be transferred to its flash memory at which point it will program the main PIC18F18855.

 

mplab xpress ide compiling project

 

All you need to do is drag and drop your compiled code / hex file onto the Xpress drive that shows up when you plug in the Xpress board and in an instant your board will take that hex file and program itself with that code.

 

compiled project hex file uploading to board

Drag and drop compiled HEX file to the MPLAB Xpress board ‘drive’

 

hex file on xpress board

HEX file now appears on the MPLAB Xpress board drive. This triggers the Xpress board to automatically program itself.

 

It literally took an instant to program and I was up and running the new code. I took a short video to show the board working with this first project.

 

 

Tronicslab!

Comments

Leave a Reply

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