Hand machined mechanical pencils

Load resistance on PIC's MCLR programming pin (27/10/12)

In-circuit programming of small microcontrollers is tricky because, quite often, the pins used for programming are also used for the user's I/O. Jumpers can be used to switch the pins between user I/O and programming, but this is cumbersome - after all, the reason for using a small micro is to reduce the overall size, and we don't want to have to add a couple of jumpers. However, in certain situations, this isn't actually necessary.

Consider the circuit below. It's a simple little circuit which reads the status of three switches (on GP3, GP4, GP5) and then outputs stuff on GP0, GP1, GP2.

For this PIC, the three programming lines are DATA on GP0, CLOCK on GP1 and VPP on GP3. We can connect GP0 and GP1 to the programmer no problem, because these aren't connected to anything else in the circuit. However, what about GP3 for the programming voltage? There is a 10kΩ resistor between it and ground. It turns out we can also connect it directly to the programmer, so long as the resistor doesn't load the programmer's output too much. As a test, I varied the resistor and looked at what programming voltage was achieved, and whether the PIC programmed properly. My programmer is an EasyPIC5 board - others will no doubt vary, depending on how the programming voltage is generated.

Here's a wee graph of VPP vs. the load resistance. Anything below the red line did NOT program successfully. Since, in this application, the resistors serve purely as pull-downs, a large value can be used which does not load the programmer.

Note that, if the resistors were used as pull-ups instead (with the switches connected between the PIC pin and ground), things might be different, because the programmer would have to sink current from the 5V supply through the resistor when the programming voltage drops to zero. It may be incapable of doing this. Again, since here the application is just detecting a switch, active-high inputs are just as easy to use as active-low.