There are three ways to program a Pic microcontroller
- Using general programming hardware (high volt programming Hvp).
- Low volt programming (Lvp).
- 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 general microcontroller operation.
Note: To make Icsp work correctly you have to think 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 institute for Icsp use by using isolation resistors to general 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.
Pic Micro: High Volt Programming
To use the first formula 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 facts from the Pc via one of three interfaces either:
- The Rs232 Com port
- The Parallel port
- The Usb port
You select the interface you want to use and then select an standard 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 convenient for the target microcontroller.
Note: practically 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)
Lvp is exactly the same as Hvp except:
- The Vpp voltage is set to the general provide voltage.
- The Pgm pin indicates programming mode.
Note: In this mode you can not use the Pgm pin for whatever else it is dedicated solely to Lvp control.Devices are man-made 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 formula since for the Lvp formula you have to sacrifice one pin - Pgm - (to tell the Pic Micro whether 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 advantage 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 scholar micro which would then program each one in turn - and this is only potential since the Vpp signal is a general 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 elucidate 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 commonly 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:
- You have to program the bootstrap code using Hvp or Lvp.
- It uses up some of the microcontroller resources.
Once programed it provides a convenient way of using the expedient as you won't need programming hardware anymore and one major advantage is that you can re-program a expedient without undoing the equipment e.g. If you boxed up you task you could still re-program it using the serial port!
You can find more facts from the website here and how to build a website like it here.
Pic Micro Hardware Programming Methods
FHA Loan to Value Limits Wireless Internet Camera Surveillance