Become a subscriber (Free)

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

PIC Micro hardware programming methods.

There are three ways to program a PIC microcontroller

  1. Using normal programming hardware (high volt programming HVP).
  2. Low volt programming (LVP).
  3. Bootloading.
The first two methods use the programming port of the PIC microcontroller labeled ICSP (In Circuit Serial Programming).

This port is shared between the existing pins of the microcontroller and after programming the pins revert back to normal microcontroller operation.

Note: To make ICSP work correctly you have to consider the effects and requirements of the ICSP programmer e.g. for HVP a high voltage exists at the Vpp pin (your circuit must be able to handle the high voltage - up to 13V).  Also the loading for the other signals PGC and PGD must not be too high i.e. don't put an LED on these pins that uses 20mA - if you did the voltage levels would not be high enough at the inputs to the PIC for programming.  

It's fairly easy to design for ICSP use by using isolation resistors to normal circuitry and choosing not to use heavy loads on these pins.

ICSP provides 6 connections from the pic ICSP programmer to your board as follows :

VPP (or MCLRn) Programming voltage (usually 13V).
Vcc Power (usually 5V).
GND Ground (zero volts).
PGD - Data usual port and connection RB7.
PGC - Clock usual port and connection RB6.
PGM - LVP enable usual port and connection RB3/RB4.
If you are not using low volt programming
then ignore this pin and disable LVP when
programming the chip. 

PIC Micro: High Volt Programming

To use the first method a hardware interface is needed or 'PIC programmer' to interface between the programming software (usually running on the PC) and the PIC chip.  This hardware takes its information from the PC via one of three interfaces either:
  • The RS232 COM port
  • The Parallel port
  • The USB port
You choose the interface you want to use and then choose an appropriate PIC programmer.  The PC then communicates with the hardware generating the serial (ICSP) signals to translate the PIC hex file into a serial data stream suitable for the target microcontroller.

Note: Almost all PIC microcontrollers use the ICSP interface so once you have a HVP you can program virtually any PIC microcontroller. e.g. you can program 12F675, 16F84, 16F88, 16F877(A), 18F2550, 18F452 etc.

There are several programs for programming PIC micos e.g. ICPROG and many different hardware programmers.

PIC Micro: Low volt programming (LVP)

Usually you will not want to use LVP it is a specialized operation that is not normal for standard use - so disable it.

LVP is exactly the same as HVP except:

  • The Vpp voltage is set to the normal supply voltage.
  • The PGM pin indicates programming mode.
Note: In this mode you can not use the PGM pin for anything else it is dedicated solely to LVP control.

Devices are manufactured with PGM mode enabled and the only way to turn off the PGM mode is to program it using an HVP programmer.

Note: Some PIC microcontrollers can only use the HVP method since for the LVP method you have to sacrifice one pin - PGM - (to tell the PIC Micro either that it is being programmed (high volts e.g. 5V) or that it is not being programmed (0V) ) and some PIC micros only have 8 pins e.g. 12F675.  For this chip the PGM pin is not available so HVP is the only way.

The real benefit of using the LVP mode is that you can program several PIC Micros on a board without having to individually program each one - you could daisy chain each extra micro to a master micro which would then program each one in turn - and this is only possible since the Vpp signal is a normal logic level in LVP mode.

PIC Micro: Bootloading

Bootloading uses any available interface to load a program into program memory.  It requires a bootstrap program to interpret the interface data and translate it into program memory instructions.  

Note: Note only the newer devices that are capable of programming their own memory can use this method.

Typically a serial port is used for bootloading and the PIC micro bootstrap program will wait for a set time after power up listening on the serial port for a reserved word that tells the bootstrap program to start i.e. it listens for sequence of characters that is not normally used on the interface

Once it receives this sequence it enters bootstrap mode where a hex file is transmitted to the microcontroller over the interface.  It interprets this and programs the memory of the microcontroller and then starts the program.

There are two issues with this method:
  1. You have to program the bootstrap code using HVP or LVP.
  2. It uses up some of the microcontroller resources.
Once programed it provides a convenient way of using the device as you won't need programming hardware anymore and one major benefit is that you can re-program a device without undoing the equipment e.g. if you boxed up you project you could still re-program it using the serial port!

New! Comments

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



Claim Your: Useful

"Arduino Software Guide"

   Right Now...





Privacy Policy | Contact | About Me

Site Map | Terms of Use



Visit our Facebook Page:

   Click Here



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:

Now



:
:
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

SUPERB and FANTASTIC."

- Ranish Pottath

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

- Milan

bursach<at>gmail.com<

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


- Matt
matt_tr<at>
wolf359.cjb.net


Learn Microcontrollers

"Interested in
Microcontrollers?"

Sign up for The
Free 7 day guide:

FREE GUIDE : CLICK HERE


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


- Dave

de_scott<at>bellsouth.net

"Your site is a great
and perfect work.
congratulations."


- Suresh

integratredinfosys<at>
yahoo.com

"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.
Regards."


- Anon

Recent Articles

  1. How to use the DHT22 (or DHT11) with an Arduino; full code and description. Also including a comparison of the DHT11 vs DHT22.

    The Essential Guide to the DHT22/11 humidity sensor including a library code guide for the Arduino. Learn how to determine Humidity, Dew point and Heat Index.

    Read more

  2. How to Use the MAX7219 to drive an 8x8 LED display Matrix on the Arduino.

    The Essential Guide to the MAX7219; What it is and how you can easily use one in any of your projects.

    Read more

  3. How to use a DS18B20 (single or multiple on one wire) for temperature measurement using the Arduino Uno.

    How to Easily Use the DS18B20 Maxim One-Wire thermometer with Arduino example code showing external or parasitic power modes.

    Read more