Navigation

Saturday 3 September 2016

Using MPLAB software for programming a PIC microcontroller – Part 2

In this tutorial, procedures on how to simulate a PIC18F1320 microcontroller using the HEX code generated by the MPLAB software will be explained. Also, programming the physical chip using PICKit3 will be shown.

Below is a circuit in Proteus ISIS that blinks an LED every 500ms explained in the previous post. The LED is connected as a pull up resistor to pin RB2 of the PIC. Not that in the software, it is also pin RB2 that is being turned ON and OFF. The circuit also shows connection of the PIC to the PICKit programmer.


After drawing the circuit, Right click on the PIC18F1320, Choose Edit Properties. The following screen will appear.


On the Program File Text box, navigate to the folder where the MPLAB program in the previous tutorial was saved. Choose the HEX file that was generated. In my case, the C code written is saved as main.c so the HEX file generated was main.HEX.

Also, edit  the processor clock frequency which should be the same as that chosen in the MPLAB C code.

Click on Play button to run the simulation. The LED should begin to blink


To program a physical PIC8F1320 chip, connect the same circuit on a breadboard, stripboard or PCB as shown in the circuit diagram above.

In the MPLAB software, go to Programmer -> Select Programmer -> PICKit3. Make sure the PICKit3 is detected and program the chip. Once programmed, the LED will begin to blink.


1 comment:

  1. The video regarding programing IC8F1320 chip is vry informative, I appreciate this great work. prototype pcb assembly

    ReplyDelete