How to program microcontroller using pickit2/3

on Thursday, 3 October 2013
Soon we are going to start our project making, before we start we need to know how we burn or program PIC microcontroller using Pickit2.
What is this Pickit 2?
If we want to write data to our memory cards we use card reader/write, if we want to burn our CD/DVD we use CD/DVD writer, in the same way if we want to store our program (burn or program) into the microcontroller we use pickit2 or pickit3. In general they are called as 'Burners' or 'Programmers'.
If we want to program 8051 microcontroller then we use corresponding programmer similarly we need to select burner depends on the microcontroller we use. As we are going to use PIC 18f we are using Pickit2.  
Introduction:
When i was beginner in this field of project making, i was unable to find the correct direction or source to program or burn a microcontroller. This post clearly explains you how to write a program, how to burn into the microcontroller. I'm using PIC 18f452 and 'pickit2/3' to demonstrate but all the steps are quite common for all other models too.

STEP 1:
Write a program using any of the C compiler or Assemblers. some of the famous compilers are
>> mikroC
>>PICC 18
>>C18
>>CCS
Is it different to program for different compilers ? Answer is yes, but differ in least , the basic C programming is the same but if you are including library functions then you need to know what are the library functions offering by  that particular compiler, check the 'help' section of  your compiler to know all the library functions.

After compiling various files will be generated, but we only concern with the file with extension .hex , because we burn or load this file into our microcontroller.

STEP 2:

How to know whether our code works fine or not, so its better to check it though various simulating software's. One of the famous simulating software is PROTEUS ISIS. You will get lots of tutorials online.

STEP 3:
After verifying our code though simulators, next step is to burn it into our microcontroller.
I'm using pickit2 tool for burning or programming, follow the below steps.
>> Install pickit2/3 software on to your pc/laptop.
>>We need have microcontroller and pickit2 burners , in order to program  first we need to place our pic18f452 (or any other) on the bread board, now we need to make few connections on to the bread board. Below fig clearly shows the connections for pic18f452


how to program pic using pickit2/3




Wire the above connections onto your bread board and connect it with pickit2/3 and connect your device to your pc/laptop.
Imp Note: If you are using any other microcontroller other than pic18f452 then first check the "pic18f452 pin diagram" and corresponding to it find out the pin numbers of your microcontroller model and connect it as shown above.

For example if you want to use pic18f2450, then we can know from the pin diagram of pic18f452 that pin1=Mclr pin, pin12=pin31=vss, pin32=vdd, pin39=PGC/ICSPCLK, pin40=PGD
/ICSPDAT so, now the pins of pic18f2450 corresponding to pic18f452 is
Mclr=pin1 of pic18f2450 , vss= pin8=pin19, vdd=20pin , pgc=27pin, pgd=28pin

Look at the writing connections of PIC 18f2450 below
















STEP 4:
>> open your installed pickit software.It look like this before connecting your pickit2 to your pc/laptop   (v2.31)

Steps to be followed after you connect your pickit2/3 to pc/laptop:
>>Be sure to check whether your microcontroller model number is showing at top right corner beside               "Device:"  or not.
>> 'Check' (tick) the 'on'  power , better to maintain 5v.
>>Go to 'programmer' option , check whether 'verify on write' is selected or not, if not  selected make it tick      mark(select it)
>> 'Read' , 'Write', 'Verify' , 'Erase', will be active after your connections are made good.
>> Now, click on Read, wait until you processing shown completed.
>>Next, click 'Erase'
>>Go to file>> Import file>>browse your .hex file location.
>>After your import the file successfully, click on 'Write' option.
>>It take 1min or less to write your .hex file to your microcontroller, it look like this fig below


AUTHOR: YOUSTRON SIC

8 comments:

Anonymous said...

nice one


emran

YOUSTRON SIC said...

Thanq :-)

Anonymous said...

Hi,
How to copy mcu and how to burn to chip ABOV SOP28?
Thanks

Anonymous said...

i am getting PICkit2 VDD voltage level error.Check target and retry operation.What should i do ? :/

Deyan Simeonov said...

The HUMANOID robotic ARM using pic microcontroller The purpose of the HUMANOID robotic ARM project is to implement the position control and vision control on the robotic arm. Which in my opinion is one of the best things happening and even KLDS and http://microcontrollerslab.com/ talked about this.

Syed Zain Nasir said...

You should also check out Arduino Projects on http://www.TheEngineeringProjects.com/ There are many Arduino Projects there.

Syed Zain Nasir said...

You should also check The Engineering Projects because they have posted a lot of Arduino Projects and PIC Mirocontroller Projects and have also designed many new Proteus Tutorials. I hope you guys are gonna like them.

Aman Rustagi said...

I would also recommend C programming tutorial along with microprocessor programming. If your fundamental concepts of C programming like data types in C, pointers, array, functions and loops are strong the learning microprocessor programming won't be a big deal.

Post a Comment