Getting Started with MPLAB IDE

PIC10/12/16 MCUs is the compiler use to compile the code for PIC 10,12 and 16 family. In this tutorial, we are going to use MPLAB with HI-TECH C compiler to compile and upload to PIC16F877A(if you are using PIC16F887, just choose PIC16F887 instead of PIC16F877A whenever required).MPLAB supports Windows, MAC OS and LINUX. Here, we presume that you are using Windows. Download the MPLAB IDE from download page.

We have also created 3 videos to show you how to create project and program PIC16F, PIC18F and PIC30F using MPLAB IDE.

MPLAB IDE & HITECH C PRO Installation

Please install MPLAB IDE and HI-TECH PICC Lite according to the following steps. 

  1. Double click on the Setup to install MPLAB (this version is V8.70).
  2. The Install Shield Wizard will pop out.MPLAB1
  3. After all the directions shown in the welcome note (as in following diagram) is done, please click Next> for next step.
  4. Select I accept the terms of the license agreement if it is not selected in the diagram below, and click Next> after this.
  5. Select Complete for the setup type to install all program features, and click Next> to next step.
  6. In the Choose Destination Location, user is recommended to use the default destination folder, which is C:\Program Files\Microchip\ or user is also free to select the other destination folder by using the Browse… button to browse to the desired destination folder. After that, click Next> for next step.
  7. Select I accept the terms of the license agreement if it is not selected in the diagram below, and click Next> after this.
  8. Select I accept the terms of the license agreement again for the window shown below, and click Next> after this.
  9. A window for Question will pop out, click YES to proceed with installation of HI-TECH C.
  10. Click Next to Install HI-TECH C.
  11. Select I accept the terms of the license agreement if it is not selected in the diagram below, and click Next to Install HI-TECH C.
  12. Click Next> to proceed.
  13. Select Add to environment path if it is not selected in the diagram below, and click Next to proceed.
  14. Wait for the installation process to be completed.
  15. Click Finish after successfully installed the HI-TECH C.
  16. The installation of MPLAB V8.70a is completed. Click Finish to exit. User may need to restart the computer just after the installation or restart later.

CREATE PROJECT

We will be using the sample code of DIY project – PR5 for this example. You can download it here

  1. Go to Project on the toolbar ►  Project Wizard…
  2. When a windows appear, click Next.
  3. Choose the type of device that you want to use and click Next.   (choose PIC16F877A for this case because the sample code is using PIC16F877A)
  4. Choose HI-TECH Universal Toolsuite in Active Toolsuite. HI-TECH ANSI C Compiler will show up in the Toolsuite Content.  
  5. Choose a destination where the project you create can be saved and type the project name. After that, click NEXT>.
  6. Add the existing file(source file, header file) to the project by selecting the directory folder where the files are located and add to the project created. For source file, it will be *.c file while header file will be *.h file.
  7. Click Finish.
  8. Or you can manually add the source file and header file after you created the project by Right clicking on the Source Files  or Header FileFile directorySelect the File (*PR5.c for this example) ► click Select
  9. Or if you have an existing project (for some Cytron’s tutorials, the project is given), you can open the project from Project ► Open ► File directory ► Select the File (*.mcp ) ► click Open 

EDIT, COMPILE AND LOAD 

        1. To view the project that you have created or opened, click ► Project ► View project. Your project bar should appear.
        2. To edit your source code, double click on the *.c file(PR5.c) under Source Files
        3. After you have edited your code, you are ready to compile and load it to your device.
        4. Right click on the project title(PR 5.mcp) ► choose Build.
        5. In order to load the file to the device, connect the programmer(UIC00A/UIC00B) to the computer and the device.
        6. You can choose to load from MPLAB or using PICkit 2 Programmer software

LOAD FROM MPLAB

      1. Go to  ProgrammerSelect Programmer ► Choose Pickit 2
      2. Again, go to Programmer> Setting.
      3. Tick the box as below.
      4. Right click on the project title(PR 5.mcp) ► choose Build. 
      5. That’s it.

LOAD FROM PICKIT 2 PROGRAMMER SOFTWARE

      1. Download and install PICkit 2 Programmer software.
      2. Open the software
      3. Go to Tools ► Check Communication
      4. Go to File ► Import Hex ► 
      5. Go to the project folder that you created ► Choose the *.hex file    
      6. Click Write
      7. That’s it. You can repeat to edit, compile and load until you have achieve the result you want.

How to create a PIC16F project and program it using MPLAB IDE

How to create a PIC18F project and program it using MPLAB IDE

How to create a dsPIC30F project and program it using MPLAB IDE

, , , , ,

Related Post

Simple steps to control Stepper Motor using 2Amp Motor Driver Shield and CIKU

Using MDD10A with CIKU

Sensing: Vibration & Tilt

SKds40A + dsPIC30F4013 Library

5 thoughts on “Getting Started with MPLAB IDE

  1. hai…..
    bagaimana saya nk dapatkan library untuk pic16f876A kerana dalam software MPLAB saya tiada library 2……prgram saya berkaitan dengan pic16f876A lah…tq

  2. I think you did not install HI-TECH C Compiler correctly or you did not setup the project properly. Please do continue the discussion in our technical forum where you can paste printscreen of your MPLAB IDE and we can further point out the problem.

  3. Hi, i try to load the Project Hello Word to the SK40C, however when i try to build the coding, its failed to build? why that happen? tq

Leave a Reply

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