Main page Castellano  Deutsch  English 

How to program a PIC 12Fxxx/16Fxxx

These PICs are programmed using a proprietary serial protocol. So you can't connect them directly to any "usual" interface. Fortunately, the timing requirements are rather lax. This gives the possibility to use some pins of a parallel or serial port of the PC to generate the programming sequence by software.

[Schematic] Besides the operating voltage, three further signals are necessary: the programming voltage Vpp (about 13V) and the programming Clock (clk = PGC = ICSPCLK) and Data (data = PGD = ICSPDAT).

Since most PICs tolerate a programming voltage Vpp somewhat below the specification, one can take advantage of the ±12V signal levels of the serial port of a Desktop PC and "burn" a PIC without the need for an extra power supply.

The level conversion can be done with a few components.
However, this simple circuit has its limitations and allows only reading and programming the PIC. There is no guarantee that it works with all controllers, since it does not meet all programming specifications.
(Board layout (inverted), Placing)

See below how to connect the programming signals to the PIC.

In-circuit programming of a PIC

ICSP offers the possibility to program the microcontroller within the application circuit. This is especially beneficial in class room or developing environments, where repetitive change between programming the PIC and testing the circuit occurs. It not only avoids risks when moving the PIC between different sockets – like bending the pins or "tormenting" the PIC with electrostatic discharges –, but also saves time.

To be able to use ICSP neither the circuit must disturb the programming signals nor the programming signals should affect the circuit.
The main programming conditions are:

  1. The programming voltage Vpp applied at /MCLR should switch between zero and 13 volts within a few microseconds.
  2. The clock and data signals must reach near rail-to-rail levels within one microsecond.
  3. Some PICs use a pin (RB3 or RB4) as PGM signal to offer Low Voltage Programming (LVP). This pin must stay Low while programming.
  4. Some PICs require that the programming voltage Vpp is applied before the operating voltage Vdd. In this case Vdd must be operated by the programmer module.

The simplest way to fulfil the first two conditions is, not to use the corresponding pins within the application circuit. If you also want to use the debugger, this is a must.

[ICSP schematic] Recommendations:

Assignment of the ICSP signals to the pins of a PIC 12Fxxx/16Fxxx

The number below the signal name corresponds to the pin of the ICSP connector of the programmer module.

Pay attention: the ICSP connector of this programmer module has a different order of signals than other PIC-programmers. For using it with third-party test boards an adaptor is necessary.

Controller Vpp
(1)
GND
(2)
Vdd
(3)
Data
(4)
Clk 
(5)
PGM
@ "Low"
Programming
Vdd range
8-pin 12F629/675 4 8 1 7 8 - 4.5V - 5.5V
other 12Fxxx 4 8 1 7 8 - 2.0V - 5.5V
14-pin 12F630/676 4 14 1 13 12 - 4.5V - 5.5V
other 16F6xx 4 14 1 13 12 - 2.0V - 5.5V
18-pin 16F62x(A), 16F648A 4 5 14 13 12 10 4,5V - 5,5V
16F716 4 5 14 13 12 - 4,5V - 5,5V
16F818/819 4 5 14 13 12 9 2,0V - 5,5V
16F84(A) 4 5 14 13 12 - 4,5V - 5,5V
16F87/88 4 5 14 13 12 9 2,0V - 5,5V
20-pin 16F6xx, 16F785 4 20 1 19 18 - 2.0V - 5.5V
28-pin 16F7x 1 8, 19 20 28 27 24 4.75V - 5.25V
16F7x7 1 8, 19 20 28 27 - 4.75V - 5.25V
16F87x 1 8, 19 20 28 27 24 2.5V - 5.5V
16F87xA 1 8, 19 20 28 27 24 2.0V - 5.5V
16F88x 1 8, 19 20 28 27 24 2.0V - 5.5V
16F91x 1 8, 19 20 28 27 24 2.0V - 5.5V
40-pin 16F7x 1 12, 31 11, 32 40 38 36 4.75V - 5.25V
16F7x7 1 12, 31 11, 32 40 38 - 4.75V - 5.25V
16F87x 1 12, 31 11, 32 40 38 36 2.5V - 5.5V
16F87xA 1 12, 31 11, 32 40 38 36 2.0V - 5.5V
16F88x 1 12, 31 11, 32 40 38 36 2.0V - 5.5V
16F91x 1 12, 31 11, 32 40 38 36 2.0V - 5.5V

Connection schemes with lateral placing of the ICSP connector

The following schemes show how to connect the programming signals to the PIC 12Fxxx/16Fxxx.

[Connection schemes]


back to the main page