Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

pic16f877 in circuit programming

Not open for further replies.


Member level 3
Apr 26, 2002
Reaction score
Trophy points
Activity points
pic16f877a circuit

Well I'm attempting to integrate in circuit programming into my application and I was wondering whether anyone has done this before. My problem is interfacing high voltage in circuit serial programming for PIC16F877 via pin PIN 1, RB6 and RB7 at the same time use this pin for another application. I have considered using jumpers to switch affected pins but this I don't really like. Do you guys know of a better way of making this system completly automated? i.e. I will only have to plugin the programming cable and program the pic straight away. Use of Bootloader is not an option though


pic16f877 in-circuit programming

I have not seen another way of doing this automatically. The best isolaton is with jumpers or DIP switches. If there is another way I would also be interested. My understanding is that the high voltage only effects the /MCLR pin and not RB6 and RB7.

Good luck

use rb7 18f2550

You're correct digidot about high voltages only affecting /MCLR pin. voltages RB7 and RB6 are not always 0v-5v either and are dependent of how good the programmer is. This might have an adverse effect on any device dependent of these pins. Also you don't want to send the attached device into an unknown state.

Thus I have 2 solution for 2 scenarios

1> programming will occur via a plug n play connector.
which will behave much like the jumpers you sugested. Only this time one of the pins on he connector will switch ON an active low trasistor logic which will in turn, enable or disable RB7 and RB6 for either programming mode or I/O mode

2> Introducing an enable bit for the affected pins. This will of course involve sacrificing an extra IO pin, to enable 2 trasistor switches for normal IO mode and vice versal.

In some cases however we need not worry too much if the device connected have a master enable pin e.g an LCD. When the PIC enters programming mode the device will automatically be disabled anyway so invalid data ment for the PIC will simply be ignored by the LCD. Well, that was the idea I had after researching a bit further. Feel free to suggest modifications to this.

pic16f877 circuit

The idea of using transistors to switch the RB6 and RB7 lines seems to be the best. I really like the idea. I will try it out on a new design. If you try it before I do then please let me know. I will do likewise.

Keep well

pic 16f877 circut

why don't you use the low voltage mode programing (0-5v all pins)??

pic16877 in circuit programming

using low voltage mode, is the same as
losing the pin rB3 i/o. so, i dont like it either....
otherwise, using standard high voltage mode
could be done, when u use a voltage switcher on the mclr pin, combined with a
analog switch 4066 on the rb7, rb6 pin.
this all, switched automaticly or with a
slide switch (program/normal).

for now, i am using a testboard (home made)
that i switch with a rotary sw.
that rotary is switching the mclr/rb6/rb7/power lines.
in prog mode, i use a mini relais to switch off the parallel port lines, and put the
attached buffers to the appropriate level.

maybe this setup is helping, to solve
a new setup who is better/portable.


<font size=-1>[ This Message was edited by: gelly on 2002-04-28 22:35 ]</font>

icsp pic16f877 vpp voltage

Very good point gelly. LVP is definately not an option. And Using a mechanical switch is what I'm trying to get rid of altogether. Back to the use of transistors. A slight modification. I can take advantage of the fact that, during high voltage programming the voltage on MCLR will exceed well over 10V in comperison with 5V during normal operation. A simple detection circuit can be used to control an analogue switch or transistors for RB7 and RB6 as the case may be. However, the big quenstion I'm yet to investigate is that, once programming begins,will I be correct to say that the voltage on MCLR will never drop below 10V even for 1ns until programming is finished?

I will appreciate your insight into this. And yes Digidot I'll be applying this method to a prototype and will let you know about the outcome.

pic16f8xx parallel port programmer lvp

I use small rele and one taster to switch between programing uC and use uC. There is no mistake.


icsp lcd rb6 rb7

that should work i suppose


<font size=-1>[ This Message was edited by: D1_DRE on 2002-05-01 19:27 ]</font>

mclr pic16f877 circuit

I just added ICSP in both of my circuits. Here is what/how I found/did.

Using the 16F was pretty easy. Simply put a diode on the VPP (pin 1), RB6 & RB7 are both outputs on my circuit. So, this had no adverse effect by simply connecting them directly to my programmer.

The 18F part was a little more difficult. RB6 and RB7 were outputs, but they went to an RF chip. So, I had to add a pull-down resistor to make sure that the RF chip was in stand-by mode when programming. The stand-by pin also went to the pic, but I couldn't leave it floating during programming.

I tested the PIC16F parts with the ICSP from Microchip and had no problems. I did have to set a flag in Hi-Tech compiler to tell it I was doing ICSP.

The PIC18F parts have been nothing but trouble for me. I tried to use Microchip's ICD2. I have had NO luck at all. It simply doesn't work. I don't know if the problem in the 18F part or the ICD2. I tried upgrading the firmware and MPLab, but nothing seems to work. I tried different PIC18F242 parts, nope. I'm hoping they'll fix this soon, so that my new design can use this feature.

BTW - both of my circuits are running at 3.5V. ICSP works fine according the data sheets and app. notes. ONLY VPP goes to 13V. The only difference in low-voltage mode is that you loose a port B pin and you don't need 13V on VPP. In BOTH cases RB6 and RB7 only go to your VCC voltage.

Hope this helps...


My problem is interfacing high voltage in circuit serial programming for PIC16F877 via pin PIN 1, RB6 and RB7 at the same time use this pin for another application.

I have not use the F877 so far, but you write it as if the high voltage pin is used for other applications as well. Ok, then just isolate it with a resistor (say 1k) and put a 5V1 Zener diode to the other circuit. On the PIC side you put the Programming connector. The pin can then be connected to 5V logic, and still be used as high voltage input during program (without damage to the other circuit).

Use 3V3 Zener for 3V logic.


nice idea about the use of zener diode. However, This method will not prevent transmission of false data to the device pluged to this IO pin. what if the device is something a digital potentiometer. This implies that at the end of a programming sequence either you like it or not your tim pot would have shifted by an unknown increment. Think of what the implication will be, if the device is used in active control such as my application

Still use a resistor as suggested by jetmarc and use a pin on your ICSP connector to pull used lines via diodes to low after the resistor (no need for zeners).

You also can use diodes to prevent High voltage being directed to your local 5V power supply of target circuit.

This should work even if processor is running.
Programming mode will be entered as soon MCLR is triggered.

Any lines connected to other circuits will carry "0" level and not any data or so.

Just put a series resistor in the RB6 and RB7 i/o lines of about 4K7 to isolate them from the rest of the circuit. (min 2K7) If they are inputs, depending on the source impedance, it wont hurt them, if they are outputs, depends what thier driving, worst case, use a buffer or transitor the circuit end of the resistors.
Most proggramers are quite happy with this arrangement.
Good luck. :-?

Not open for further replies.

Part and Inventory Search

Welcome to