| There are three ways to program a PIC | | | | PIC Micro: Low volt programming (LVP) |
| microcontroller | | | | LVP is exactly the same as HVP except: |
| | | | - The Vpp voltage is set to the normal supply voltage. |
| 1. Using normal programming hardware (high volt | | | | - The PGM pin indicates programming mode. |
| programming HVP). | | | | Note: In this mode you can not use the PGM pin for |
| 2. Low volt programming (LVP). | | | | anything else it is dedicated solely to LVP control. |
| 3. Bootloading. | | | | Devices are manufactured with PGM mode enabled |
| The first two methods use the programming port of | | | | and the only way to turn off the PGM mode is to |
| the PIC microcontroller labeled ICSP (In Circuit Serial | | | | program it using an HVP programmer. |
| Programming). | | | | Note: Some PIC microcontrollers can only use the HVP |
| This port is shared between the existing pins of the | | | | method since for the LVP method you have to |
| microcontroller and after programming the pins revert | | | | sacrifice one pin - PGM - (to tell the PIC Micro either |
| back to normal microcontroller operation. | | | | that it is being programmed (high volts e.g. 5V) or that it |
| Note: To make ICSP work correctly you have to | | | | is not being programmed (0V) ) and some PIC micros |
| consider the effects and requirements of the ICSP | | | | only have 8 pins e.g. 12F675. For this chip the PGM pin |
| programmer e.g. for HVP a high voltage exists at the | | | | is not available so HVP is the only way. |
| Vpp pin (your circuit must be able to handle the high | | | | The real benefit of using the LVP mode is that you |
| voltage - up to 13V). Also the loading for the other | | | | can program several PIC Micros on a board without |
| signals PGC and PGD must not be too high i.e. don't | | | | having to individually program each one - you could |
| put an LED on these pins that uses 20mA - if you did | | | | daisy chain each extra micro to a master micro which |
| the voltage levels would not be high enough at the | | | | would then program each one in turn - and this is only |
| inputs to the PIC for programming. | | | | possible since the Vpp signal is a normal logic level in |
| It's fairly easy to design for ICSP use by using isolation | | | | LVP mode. |
| resistors to normal circuitry and choosing not to use | | | | PIC Micro: Bootloading |
| heavy loads on these pins. | | | | Bootloading uses any available interface to load a |
| ICSP provides 6 connections from the pic ICSP | | | | program into program memory. It requires a bootstrap |
| programmer to your board as follows : | | | | program to interpret the interface data and translate it |
| VPP - (or MCLRn) Programming voltage (usually 13V). | | | | into program memory instructions. |
| Vcc - Power (usually 5V). | | | | Note: Note only the newer devices that are capable of |
| GND Ground (zero volts). | | | | programming their own memory can use this method. |
| PGD - Data usual port and connection RB7. | | | | Typically a serial port is used for bootloading and the |
| PGC - Clock usual port and connection RB6. | | | | PIC micro bootstrap program will wait for a set time |
| PGM - LVP enable usual port and connection RB3 | | | | after power up listening on the serial port for a |
| RB4. | | | | reserved word that tells the bootstrap program to |
| PIC Micro: High Volt Programming | | | | start i.e. it listens for sequence of characters that is not |
| To use the first method a hardware interface is | | | | normally used on the interface |
| needed or 'PIC programmer' to interface between the | | | | Once it receives this sequence it enters bootstrap |
| programming software (usually running on the PC) and | | | | mode where a hex file is transmitted to the |
| the PIC chip. This hardware takes its information from | | | | microcontroller over the interface. It interprets this and |
| the PC via one of three interfaces either: | | | | programs the memory of the microcontroller and then |
| - The RS232 COM port | | | | starts the program. |
| - The Parallel port | | | | There are two issues with this method: |
| - The USB port | | | | |
| You choose the interface you want to use and then | | | | 1. You have to program the bootstrap code using HVP |
| choose an appropriate PIC programmer. The PC then | | | | or LVP. |
| communicates with the hardware generating the serial | | | | 2. It uses up some of the microcontroller resources. |
| (ICSP) signals to translate the PIC hex file into a serial | | | | Once programed it provides a convenient way of |
| data stream suitable for the target microcontroller. | | | | using the device as you won't need programming |
| Note: Almost all PIC microcontrollers use the ICSP | | | | hardware anymore and one major benefit is that you |
| interface so once you have a HVP you can program | | | | can re-program a device without undoing the |
| virtually any PIC microcontroller. e.g. you can program | | | | equipment e.g. if you boxed up you project you could |
| 12F675, 16F84, 16F88, 16F877(A), 18F2550, 18F452 etc. | | | | still re-program it using the serial port! |
| There are several programs for programming PIC | | | | You can find more information from the website here |
| micos e.g. ICPROG and many different hardware | | | | and how to build a website like it here. |
| programmers. | | | | |