Getting started with MPLAB Xpress
Microchip Technology Inc. (usually referred to as just Microchip on this website) manufactures the mid-range, 8-bit PIC® microcontrollers used in mirobo projects. Microchip also makes the MPLAB® IDE software used to create, edit, and debug programs for them, as well as the MPLAB® XC C language compilers that convert program source code into machine code for the microcontroller. If you are planning on learning PIC microcontroller programming, the easiest way to start is by using one of the versions of MPLAB.
MPLAB Xpress, or MPLAB X?
Microchip’s MPLAB® IDE software is available in two different versions: the new MPLAB Xpress cloud-based IDE which runs in a web browser on most major computing platforms, and the long-standing MPLAB X IDE computer program available for computers running the Windows, macOS, and Linux operating systems.
One big advantage of MPLAB Xpress is that it runs in any modern web browser, including the browser in ChromeOS. This ability enables MPLAB Xpress to be used in schools that have replaced traditional computer labs with Chromebooks, and allows those schools to maintain effective computer technology programs in which students can develop software for their own real-world embedded microcontroller circuit projects.
The desktop MPLAB X IDE is the latest version of Microchip’s original, and much more fully-featured MPLAB programming environment. It has broader support for Microchip’s software tools than MPLAB XPress, and supports all of Microchip’s hardware programmers. Click here to find out more about MPLAB X.
Both the MPLAB X and MPLAB Xpress IDEs can easily create and compile programs for CHRP4 and UBMP4, so the IDE you choose to use for their programming activities will not make much difference. After learning the basics, moving on to developing and downloading programs for circuits of your own design is currently easier to do using MPLAB X rather than MPLAB Xpress.
MPLAB Xpress cloud-based IDE
Advantages
easy to get started using a simpler interface, and with fewer configuration options than MPLAB X
MPLAB Xpress runs in a web browser without installing or managing any software enabling its use on Chromebooks and iPads
project files are automatically saved in the cloud (but only for a short time), and can be saved to a GitHub account
no software installation or ongoing maintenance – saves space on the computer system, allows work from any internet connected computer, and the IDE software is always up to date
Disadvantages
simplified development environment with fewer capabilities and customization options than MPLAB X, and less support for software add-ins and cloud version control systems
hardware programmer support is limited to the MPLAB Snap, PICkit 4, and PICkit 5 programmers, and these require a software bridge that is only compatible with Windows, macOS, and Ubuntu Linux
myMicrochip account required for access and very limited, 3-day project storage – a separate GitHub account is needed for longer-term program storage and adds extra complexity for beginning users
requires an always-on internet connection, not ideal for remote programming of devices in the field
The biggest advantage of the MPLAB Xpress IDE is that it allows users to create, edit and compile projects using a web browser on almost any type of device. But, running in a web browser is also its biggest disadvantage – in order to run in a web browser, MPLAB Xpress ends up being a simplified IDE that implements a limited sub-set of the features of MPLAB X.
In our testing, simulating programs for debugging is one of the key features MPLAB Xpress is lacking – we have had no success using the simulator. That said, MPLAB Xpress works perfectly well for creating, editing, and compiling simple programs, and programming microcontrollers through a bootloader, such as the PIC16F1459 used in the CHRP4 and UBMP4 circuits, is really very easy.
In summary, MPLAB Xpress is a good choice if you’re looking for a simple, portable IDE, that is always up to date, integrates well with GitHub, and – this is the really important part – if you can maintain a consistent internet connection while using it.
Programming Terms
IDE (Integrated Development Environment) - software used to manage all the files in programming projects, compile programs, and download the programs into microcontrollers.
Source code files - one or more human-written files making up a computer program.
Project - a collection of source code files, IDE configuration files, and output files making up a program.
Compiler - a computer program that converts program source code into processor-specific machine code, or an intermediate machine readable format.
Assembler - a computer program that converts low-level assembly language source code into processor-specific machine code.
Machine code - the processor-specific instructions that make up a program, encoded as binary data in the memory of a computer.
Object code - compiled source code in the form of machine-readable instructions representing all, or just parts, of a program.
Linker - a computer program that combines one or more object code files into a complete program.
Hex file - a file format representing the machine code instructions and their memory locations used by a hardware programmer to write the program into the memory of a microcontroller.
Programmer - a hardware device that can read and write the memory of a microcontroller to write and verify a program’s machine code instructions into its memory.
Bootloader - a software program running in a microcontroller that is capable of writing a user program into the memory of the microcontroller without over-writing itself.
Getting started
If you are ready to get started with MPLAB Xpress, there are typically three ways you can proceed: 1 - clone (or fork) an existing MPLAB X project from GitHub, 2 - create a new MPLAB Xpress project, either from scratch or by using pre-existing source code files, or 3 - import an MPLAB X or a previously exported MPLAB Xpress project into MPLAB Xpress. Each method will be described below.
In programming-speak, a project is a more than just a program – it not only contains the project’s source code, but also all of the microcontroller configuration settings, compiler settings, debug settings, and programmer settings necessary for your program to be compiled and programmed into a microcontroller. So, users typically work within projects, rather than in individual programs, when programming microcontrollers.
Option 1 - Cloning an MPLAB Xpress project from GitHub
Github is a cloud repository that many developers use to manage and share updates to their programs. GitHub repositories typically contain the newest versions of public programming projects, and make it easy to distribute these programs to other hobbyists and end users.
A GitHub account is not necessary to clone public projects, but is required to save projects back into GitHub. While learning GitHub to effectively use all of its features is beyond the scope of this activity, it’s relatively easy to clone an MPLAB Xpress project from the mirobotech GitHub Repository.
Click the button for a step-by-step tutorial demonstrating how to clone a GitHub repository into MPLAB Xpress.
Option 2 - Creating a new MPLAB Xpress project
Developing a program for a new microcontroller circuit usually requires creating a new MPLAB Xpress project. An MPLAB Xpress project can be created either by using the source code files from an existing MPLAB X project, or by copying files from a similar project to use as a starting point for making a new project.
You can download the source files to create a MPLAB Xpress project for any mirobo circuit from the mirobotech GitHub Repository.
Click the button for a step-by-step tutorial demonstrating how create a new MPLAB Xpress project.
Option 3 - Importing an MPLAB X project
MPLAB Xpress has the ability to import projects saved by the desktop MPLAB X IDE, and can also export projects in a format ready to be used in MPLAB X.
MPLAB X projects typically consist of a folder containing source code files, a makefile, and additional folders with information related to the project. MPLAB X project folders have a .X folder name extension. The contents of a sample MPLAB X project folder are shown here:
To be able to import the MPLAB X project in MPLAB Xpress, it has to be compressed as a .ZIP archive first. Select all of the files in the MPLAB X project, and then compress them into a .ZIP archive by right-clicking and choosing Send to, and then Compressed (zipped) folder in Windows, or by right-clicking and choosing Compress in macOS.
Start MPLAB Xpress by opening the MPLAb Xpress could-Based IDE start page (this link will open the page in a new browser tab) and clicking the Get Started Now button:
If you are already logged into a myMicrochip account, MPLAB Xpress will start to open. Otherwise, you will end up at a page where you can sign-in to your account or register for an account.
After signing in and launching MPLAB Xpress, it will start up in your web browser. It may take some time for MPLAB Xpress to open, as it needs to pre-load its code into the browser.
When it opens, choose Import Project from the File menu:
When the Import Project dialogue box opens, click the Choose File button and select the project .ZIP file you created from the files in the MPLAB X project folder. Then, press the Import button.
After the project is imported, click the Header Files and Source Files organizers in the Project panel at the upper left to open them and reveal the source code files that make up the project.
Click on any of the source code files to open them in the editor window.
You are now ready to edit or build the program.
Next steps…
Build the project
Compiling the program is referred to as building the project. Click the downward-facing arrow beside the Clean and Build icon (the hammer and broom) in the toolbar and select the Clean and Build for Export option.
MPLAB Xpress will start to compile the current program and, when compilation is finished, the compiled object file – with the filename ending in a .hex file extension – will automatically be downloaded to your computer, ready for programming into your microcontroller.
Program your circuit
The easiest way to program CHRP4 and UBMP4 circuits is through the bootloader. See the downloading programs using a bootloader page on this site for more information on how to use the bootloader.
Save your MPLAB Xpress project to GitHub
Storing your project in GitHub isn’t as easy as hitting a save button. The steps involved are commonly referred to as committing the changes, and then pushing the changes to GitHub. Watch the video below to see how it’s done:
Export the program
A copy of your project can be exported from MPLAB Xpress in a format that allows it to be opened in MPLAB X by using the Export Project option in the File menu. This packages all of the project files into a .ZIP archive that will be downloaded to your computer.
MPLAB® and PIC® are registered trademarks of Microchip Technology Inc. in the USA and other countries.