Designing for Manufacturing
Show MenuHide Menu

Using the PIC MCLR pin as an Input

December 20, 2012

On early generation PICs the MCLR input was used to provide a reset input to the microcontroller.  Pulling the input low would hold the microcontroller in a reset state, and pulling it high would start the microcontroller running.

The most straightforward method to do this is to connect the MCLR pin to the positive rail.  When the power supply is switched on, the MCLR pin is automatically pulled high and the micro starts up.

One disadvantage of this arrangement is if the power supply only rises slowly, for instance if it has large smoothing capacitors to charge up when it is first switched on, the reset line could rise sufficiently to start the micro, before its supply is sufficient or stable.

To prevent this, if the power supply rises slowly, it is necessary to ensure that the reset line rises even more slowly.  By connecting a capacitor from the MCLR pin to ground, this capacitor is charged via the reset resistor when power is applied.  By appropriate choice of capacitor and resistor value, it can be arranged that the micro only comes out of reset once the main power supply has stabilised.

If the power is interrupted just after it is switched on, it could be that reset capacitor has retained sufficient charge to allow the micro to reset despite the main supply not having stabilised.  This can be avoided by providing a diode to quickly discharge the reset capacitor (via the rest of the circuit) as the main supply falls.

If you are using ICSP to program the micro, the programmer will drive the MCLR pin positive, to a value above Vcc.  To prevent this voltage damaging anything powered from the rail, a second diode is provided.

Now we have four components to include in our design, and we have used one of the pins of the micro, preventing it being used as an input.

Thankfully, the PIC has been designed so that none of these components are normally required – in fact the MCLR pin can be left unconnected if we wish.

Leave a Reply

Your email address will not be published. Required fields are marked *