Introduction to MPLAB IDE

Anish June 5, 2012 No Comments

Similar to Atmel’s AVR studio, Microchip MPLAB is a feature rich IDE which integrates compiler tool-chains into the IDE itself and also supports proprietary programming devices and debuggers for the Microchip’s Controller family. Just if you have a microchip programmer such as Pickit2 or ICD2, then just plug it to the computer and all you need is to prepare your code in the MPLAB IDE and then straight away build and download the code into your controller.

Downloading MPLAB IDE

The newer version is MPLAB X which can be downloaded here.
Here you can select the platform (operating-system) and also select the IDE to download and associate the tool-chains to download bundled with the IDE. Microchip provides HITECH-C compilers (Microchip now owns HI-TECH) in Lite mode for free, and paid version of the compiler has code optimizations. However, for the amateur hobbyist, the Lite version is more than enough. If you want a free and open-source C compiler, try SDCC (Small Device C Compiler). Microchip also includes MPASM, a free assembler along with the IDE.

So, select the compilers you want as there are different compiler for different MCUs. For example, for working with PIC16F84A and PIC16F878A, you need to download the compiler suit named HI-TECH C compiler for PIC 12,16 devices and for working with PIC18F2550, you have to download MPLAB C18 compiler. So choose what compiler you want based on the controller you are going to use. Also, you need not download MPLAB C18 compiler if you wont work with PIC 18 devices right now (you can also download it later at microchip’s website and install it). Select the options you want and press the download button. There is also a small video on how to install on this page.

Installing and configuring:

After downloading, you must install the MPLAB IDE and then the C compilers.
For windows users, Installation is straight forward, follow the onscreen instructions.
For linux users, you will download a .run file. All you need to do is to run this file (just double click and follow the instructions) or at the terminal enter

./filename.run

But in some distros like openSUSE (as in my case), the file is not set as executable by default. So, you have to manually set it to executable. To do this, in the terminal, navigate to the location of the file and as a super user enter,

chmod +x filename.run

And then type

./filename.run

But the C compilers are windows files and to run in linux, you must install it using wine.

Now to configure:

Select Tools → options in the IDE
In the window appeared as below, choose embedded tab at top and in general tab, under tool-chains your compiler should be listed; if not, click add at the bottom of the box and then point to the location of your compiler installation.

Now the tool-chains will be integrated with the IDE. The interface of the IDE will somewhat look like below picture.

Here, whenever you create a new project, the project files will be shown in the project window. And when you build the project, the status is given in the output window.

Leave a Reply

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