Become a subscriber (Free)

Join 29,000 other subscribers to receive subscriber sale discounts and other free resources.
Don't worry -- youre-mail address is totally secure. I promise to use it only to send you MicroZine.

Beginners guide to the PIC Microcontroller

Part 5 : 

Programming the PIC Microcontroller:

So how do you get a program into the PIC microcontroller?

Once you have created a program either in assembler or using a high level language and created the hex file you are ready to program the hex file into the device.


The ICSP interface or In Circuit Serial Programming interface is used to program the PIC device.   The ICSP is simply a set of pins on the PIC microcontroller with the following names (or similar names)


With these three signals plus the ground reference you can program virtually any PIC device.

You can find more information on ICSP here.  

and typical connections for pic programming using ICSP here.


To do the job you need a piece of hardware which interfaces to the PIC ICSP pins and to the PC.  The interface you should use is either a PICKit2 or PICKit3. The PICKit3 is the most up to date and allows all PIC devices to be programmed, whereas the PICKit2 is an older version.

Software running on the PC translates the hex file into a serial bit stream of data and the pic microcontroller takes care of everything else.

There's also information on pic programmers here.

Programming steps

The programming hardware holds the Vpp pin at a high voltage to indicate that the PIC device must enter programming mode.

Then a stream of data is generated to the PGD pin and along with this a clock signal is sent (PGC).  The PIC uses these signals to load up its internal flash memory and program it.

Note: The ICSP is a bi-directional interface so the programming software can also read back the contents of the part for verification.

Here's a diagram of the programming set up:

Note: When the parallel port interface is used the data is still sent serially by controlling individual pins in the port.

Once you have the programmer hardware and programming software in place you won't have to worry about the details - and if you design the hardware carefully you can use the ICSP interface while your circuit is running.

This makes using the PIC micro extremely simple as you can leave the ICSP interface connected to the programmer and try out different programs - all..

.. without removing the interface, without removing the ICSP cable.

All you do is generate the hex file, hit the programming key in the programmer and check the circuit operation.

Some programmer hardware provides a ZIF socket where you transfer the PIC device from your circuit, to the programmer then from your programmer to the circuit - but I say you do not need one - None of the designs on the site require this - they are all in circuit

Next time...

...Which language ?

New! Comments

Have your say about what you just read! Leave me a comment in the box below.

Privacy Policy | Contact | About Me

Site Map | Terms of Use

Visit our Facebook Page:

   Click Here

Recent Articles

  1. PIC PWM: Easy Pulse width Modulation on the PIC Micro.

    PIC PWM : What its for and how to use it. Including an example showing typical setup of a PIC PWM module with register settings.

    Read more

  2. The Essential I2C Tutorial: All you need to know about I2C...

    How to use I2C. In this tutorial you will learn all about the 2 wire I2C serial protocol. Learn how easy it is to use, how it works and when to use it...

    Read more

  3. PIC LCD volt meter : How to use the ADC for voltage measurement.

    A 0-5V LCD volt meter project using an HD44870 display and one PIC micro ADC.

    Read more

  4. PIC Programming using ICSP

    PIC programming : How to use ICSP for programming a PIC microcontroller giving some ICSP connection diagrams and it also shows how to use MPLAB X and ICPROG.

    Read more

  5. PIC ICSP In Circuit Serial Programming

    How to program PIC ICSP, IN-Circuit, live and still have a working programmer and operational circuit!

    Read more

  6. An Ultrasonic Distance meter project: How to make one using a microcontroller.

    Understand how an Ultrasonic Distance meter works by building one your self – including Free software to drive the microcontroller and display.

    Read more

Sign up for MicroZine
''The'' Microcontroller Newsletter

Enter your first Name and primary email address in the form below:

And receive absolutely FREE a full project for:

"Measuring Analogue Voltages
Without An ADC"

(Using only one pin).

Instant Download:
You Can
Get It Right Now

Warning: This project could be  Removed 
at any time.  

It will  NOT be 
available indefinitely SO
To avoid 
disappointment  get it:


Don't worry -- your e-mail address is totally secure. I promise to use it only to send you MicroZine
Remember this is a project with full description and fully debugged C Source code - and it's not available from the main website.

You can only get it through this newsletter.

To get exclusive access Enter your first name Name and primary email address Now in the form above.:

But wait !

There's more...

You'll receive more
free and exclusive reports as well as site information and site product updates

Scroll up to the form above and sign up NOW. Don't forget it's FREE and if you don't like it, you can unsubscribe at any time.

Click Here Now to use the form above to get your Valuable information absolutely free.

Readers Comments

"I wanted to thank
you so so so much
for all the information
you have provided in
your site it's


- Ranish Pottath

"This site really is
the best and my favorite.
I find here many useful
projects and tips."

- Milan


"Awesome site,
very, very easy and nice
to navigate!"

- Matt

Learn Microcontrollers

"Interested in

Sign up for The
Free 7 day guide:


"I am a newbie to PIC
and I wanted to say
 how great your
site has been for me."

- Dave


"Your site is a great
and perfect work.

- Suresh


"I couldn't find the correct
words to define
yourweb site.

Very useful, uncovered,
honest and clear.

Thanks so much for
your time and works.

- Anon

Back to Top