Home  ›  Getting Started  ›  PIC  ›  Getting Started with MPLAB X IDE

Tags: , , , , ,

Getting Started with MPLAB X IDE

1.0 Introduction


  • MPLAB X IDE  is the new version of software program that develop applications for Microchip microcontrollers and digital signal controllers.
  • Differ from previous version, it is developed completely in-house and based on the open source NetBeans IDE from Oracle
  • Supports the ability to enter File Code Templates with license headers or template code
  • It also provides many new features that will be especially beneficial to users of 16-bit and 32-bit families where programs can grow to be extremely complex.
  • Link to download MPLAB X IDE:  MPLAB X IDE

MPLAB® XC8 is Microchip’s simple and comprehensive line of compilers that :

  • Supports all 8-bit PIC family (user only need to install one compiler for PIC 10, 12, 16 and 18)
  • Integrates with MPLAB® X IDE and all Microchip development tools
  • Link to download MPLAB XC8: MPLAB XC8 Compiler
In this tutorial (by taking Cytron Technologies DIY project as an example), you will learn how to:
>> Install the MPLAB X IDE and MPLAB XC8 Compiler
>> Add the source file to MPLAB X project
>> Convert MPLAB v8 project to MPLAB X project
>> Build the codes and load to the targeting device
 

2.0 Getting Started


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


3.0 How to install the MPLAB X IDE and XC8 compiler


3.1 MPLAB X IDE


Steps:

3.2 MPLAB XC8 Compiler


Steps:

   

4.0 Creating Projects


Standalone Project:


Video on Creating Standalone New Project MPLAB X IDE


By taking DIY Project 5 _ Line Following Robot as an example to build the code,

Steps:

1. Start the new project wizard by:

  • Click the New Project icon Main_New_Project.png on the main toolbar.or
  • Click the main menu and select File ► New Projector
  • On the keyboard, press: Ctrl + Shift + Nor
  • Right click on the project window(white space), a pop-up menuwill appear and choose New Project

2.   Choose the project type:

  • From the Categories: choose Microchip Embedded
  • On the Projects column: choose Standalone Project

           

 3.   Choose the type of device:

  • Family: All Family (or you can choose the type of family in order to choose the type of device faster) 
  • Device: Type in the type of device use (can choose from the list)
  • PIC16F84a    PR 1, 2, 3
  • PIC16F727    PR 28
  • PIC16F777    PR 19
  • PIC16F876A PR 7, 8, 9B, 10A, 10B, 11, 12, 13, 14, 15, 16, 18, 22, 24,                                 25, 27, 29
  • PIC16F877A  PR 5, 6A, 17, 23, 31

        *choose PIC16F877A for this case because the sample code is using PIC16F877A


4.    Select the tool

  • Under Hardware Tools: Choose PICkit 2 (using UIC00B)

5.   Select C Compiler or assembler

  • Choose the corresponding compiler for the source code
  • Depending on the source file using
  • mpasm (v5.45)     >> PR 1, 2, & 3
  • XC8 (v1.00)         >> PR 5, 6, 7, 8, 9B, 10A, 10B, 11, 12, 13, 14, 15, 16, 17,                                           18, 19, 22, 23, 24, 25, 27, 28, 29, 31

        *choose XC8 for this case because the sample code is using C language

6.   Name the project and choose a directory

  • Choose the project name as you like
  • Set the location for the project to be created
  • Name the project folder
  • Click finish
  • Done

5.0 Adding existing file to project


Steps:

1. Project tree

  • A project tree will appear in the upper left part of the IDE. User is now ready to add the source files to it.
  • Right click on the Source Files ► Add Existing Item… or Add Existing Items from Folders…

  • Choose the corresponding source file from the disk (you have downloaded and extract the file)
  • If you choose to add an existing item:
    • Select the source file (*.c) *Choose PR5.c for this example.
    • Choose the store file’s path from the radio buttons near the bottom right. Choose Relative.
    • Click the Select button.

          

  • If you choose to add existing items from folders:
    • Click on the Add Folder… button
    • Select a directory that contains files you want to add to the project
    • Click the Select button in the Select Source File Folder dialog
    • Repeat for as many folders as you wish to add
    • Click on the Add button

  • Done

*Note: The same applies for adding the header file and linker file to the project.

2. Build Code

  • Build the codes by clicking the Main_Build_Project.png icon on the toolbar

3. Load program

  • Connect the programmer(with the device connected) to the computer
  • Press Main_Program_Target_Project.png icon to load the program to the device

            or

        If you are using the PICkit 2 Programmer software,

  •     Download, Install and Open the PICkit 2 Programmer software
  •     Go to Tools ► Check for Communication
  •     File ► Import Hex ►  Project folder dist default ►production choose the  hex file click Open
                   

  •  Click Write

4. Done


6.0 Converting an MPLAB v8 project to MPLAB X


Video on converting MPLAB 8® Projects to MPLAB X® ID

Steps:

1.     Start the new project wizard by:

  • Click the New Project icon Main_New_Project.png on the main toolbar.or
  • Click the main menu and select File ► New Projector
  • On the keyboard, press: Ctrl + Shift + Nor
  • Right click on the project window(white space), a pop-up menu will appear and choose New Project

2.

3.


 4.

 

5.

 

6.

 

7.

 

8.

 

9.

10. If the project that you created cannot detect the source files, header files or linker files, you can manually add them to the project that you created by referring to section 5.0 Adding existing file to project

* * Video on how to Make a Project, Compile and Upload Code to a PIC Microcontroller**


2 Responses to “Getting Started with MPLAB X IDE”

  1. PIC says:

    awesome explanation for mplab x Ide

  2. musa says:

    hi thinks

Leave a Reply

Help us improve the wiki Send Your Comments