EMBEDDED C TUTORIAL

                                TIMOTHY  ADEGBITE

MODULE 3: MPLAB-X IDE.

Welcome to today’s Trinnex electronics tutorial on Embedded C, we will be talking about the MPLAB-X IDE. MPLAB means microprocessor Lab. This development tool is called an Integrated Development Environment, or IDE, because it provides a single integrated “environment” to develop code for embedded Microcontroller. X signifies the version.

I have created images, to illustrate steps in creating MPLAB project
Below, shows the image displayed when the MPLABX – IDE is launched.







After it is done loading, below shows the start page of the IDE.






Our next task is to create an Embedded C project file. You can decide to identify the project file with any name.


Before I continue, I have made the images so simple to follow and understand.
The red circle or ellipse shows the items that should be selected and the numbers signifies the order by which they are to be selected.
Below shows the steps required, in creating a project file.







  1.      Click on the New Project icon circled in red. After clicking, a window appears   
       which is labeled New Project.

  2.    Click on Microchip Embedded.
  3.    Click on Standalone  Project.
  4.    Click on the Next button.

After clicking on the next button, the image below appears  




Go to the combo box named family.

   1.    Click on the drop down menu icon.
   2.    Select the midrange 8bit MCU.
   3.    Do not click the Next Button.

Move to the combo box named devices, just below the Family combo box.
.




1. Click on the drop down menu.
2. In the drop down menu, select PIC16F84A, as shown in the image.
3. Click on the Next button.
          
After clicking the next button, the image below in displayed.




Here, you choose a debugging tool. You do not really need one now. But, you have to choose one of the tools.
  1.    Click on Simulator.
  2.    Click Next.

The next page shown, is where the compiler is chosen. Note, the XC8 compiler is only visible if only it has been installed. Choose the XC8 compiler.





   1.    Click on XC8 compiler.
  2.    Click on the Next Button.




The Next page that is shown, is where the project is named.
You have to create a folder on the desktop or elsewhere on your PC where your project files will be saved.

I have created a file on the desktop named Embedded C, for the purpose of saving my projects.

I have name my project HELLO WORLD.



  
   1.  In the project name box, type the name of your project.
   2. In the project location, click on browse, to search for the file created earlier to   
       save the project.
   3. Tick the set as main project box
   4. Click finish.
                                                                                                   

After the process of the project creation is completed, the image shown below is displayed.

Now, the project has been created. You have to create a source file. The source file is where the code is typed.


. 1.  Click on the project icon. 
  2.    Right Click on source file.
  3.    Click on New.
  4.    Select C Source File.

After selecting the source file, a window named New source file is displayed.

This is where the source file will be named. I named mine HELLO WORLD.



  1.    In the file name box, type any name of your choice by which you can identify    
        the source file.
  2.    Choose the extension of the source file as C.
  3.    Click Finish.

After the finish button has been clicked, the image below is shown.







 This is the work area, where the code will be typed.This is where the major task start. The first project will be a very simple one. We will be flashing an LED. This will be achieved through our written program in the source file.

But before then, we have to talk about the Hardware simulator that will be used. We will be using the PROTEUS 8.0 simulating software developed by labcenter Electronics.

Below shows the steps in creating a project in the Proteus 8.0


PROTEUS 8.0

Click on the Proteus 8.0 desktop icon.
The image below shows on the desktop screen after clicking.




After done loading, the image below is shown.


  1.    Click on the new project icon, the new project wizard window shows up.
  2.    Type the name of the project in the project name box. I have named mine LED 
        BLINK. 
  3 .   Browse the file path and choose the file where you wish to save the project. 
        Advise you save it in the same file as your MPLABX Project file. I saved mine in the Embedded C folder created earlier.
  4.    Click on the next button.


After clicking the next button, we have to create a schematic and also specify the size of the work area i.e. where the components will be placed, as shown below.



  1.    Click on create schematics.
  2.    Select DEFAULT
  3.    Click on the Next button.

We do not intent creating a PCB project now. That will be latter.
  1.    Choose do not create a PCB layout.
  2.    Click on the Next button.


We will not be creating our firmware through this medium
  1.    Choose No firm ware project.
  2.    Click the Next button.



Finally, click on the Finish button.

After clicking the finish button, the work area for the project is displayed as shown above.
Navigate to the file where you saved the project file. Mine was stored in the Embedded C file, Click on the Proteus Project icon, with the name LED BLINK.
After opening the file, the project is opened with the project name (LED BLINK) on it as shown below.







It is time to select the necessary components needed for our first project.
Our first Embedded C program will be titled “Flashing of an LED”. This is one of the simplest project in Embedded C for a beginner.





The first component that we need in the PIC16F84A.
  1.    Click on the pick component icon (P).
  2.    Type the name of the component (16F84A) in the search area.
  3.    Select the device shown in the result.

  4.    Click on OK.




To choose the LED, you follow the same process of choosing the PIC16F84A.





To choose the resistor, you follow the same process as mentioned above.

 It is time to create our circuit. The necessary components has been loaded in the component tray.
Click on the first component in the component tray, move the cursor to the work area, and paste the component there by just a click.  Do this until all the components has been moved to the work area.




There is a need for a ground terminal. What is the essence of the ground terminal? I will explain that soon.


  1.    Right click on the terminal mode icon.
  2.    In the component tray, choose the GROUND.
  3.    Click on it, move the cursor to the work area, and paste it there by clicking.



 After doing this;
    1.   Click on the component mode icon. This shows the components earlier selected.


This is the complete circuit needed to blink an LED.

In the next tutorial, I will explain how to write the program needed to blink the LED.
Please, practice this. There is no other secret to knowing this that constant practice.

Your comments and questions are all highly welcomed. You can forward them to trinnexelectronics@gmail.com.

Comments