MPLAB X IDE has three main components that work together to generate machine code to be loaded on a PIC microcontroller:

  1. Project Manager. The preferred way of developing programs in MPLAB is by creating a project. An MPLAB project groups all the files together that relate to the project and ensures that they interact with each other in an appropriate way and are updated as needed. 
  2.  Text Editor. This allows entry of the source code. It behaves to some extent like a simple text editor such as Notepad, but it can recognise the main elements of the programming language that is being used. Thus in Assembler it codes instructions in one colour, labels in another and comments in a third. In this way the programmer can immediately see if there is a misconception in his placing or use of text within the Assembler line. 
  3.  Assembler and Linker. The Assembler converts the Assembly language to machine language. In advanced projects, the code may be created from a number of different files. The role of the Linker is to put these together, give each its correct location in memory, and ensure that branches and calls from one file to the other are correctly established.

Creating a Project in MPLAB X IDE

            1) Open MPLAB® IDE (download)

            2) Select File>New Project...

            3) Choose project > Microchip Embedded>  standalone Project

           4. choose device you want to use 

5. Choose programmer or simulator

6. Choose compiler ( I select XC8 C compiler)

   7.  Name of your project and select folder

8. Create a new main.c in Source file and you are ready to go 

**Running the device:

After the device is programmed, some programmers hold the device in reset.  The easiest way to get the device running despite what programmer is being used is to disconnect the programmer from the target device.

No comments:

Post a Comment