This content requires the Adobe Flash Player and a browser with JavaScript enabled. Click here to get the latest version of Adobe Flash Player.

Use the MCLR pin as an output with PIC microcontrollers

By Antonio Muñoz, Laboratorios Avanzados de Investigación, Huesca, Spain, and Pilar Molina, Universidad de Zaragoza, Zaragoza, Spain -- EDN Europe, 01 Feb 2008

Although microcontroller manufacturers try to offer designers products that almost exactly fit the needs of their designs, another output pin is often necessary. This situation particularly occurs in small designs using microcontrollers with eight pins or fewer. This Design Idea employs the Microchip (www.microchip.com) PIC10F222. The PIC10F222 comes in an SOT23-6 package and offers three I/O pins, one input pin, RAM, flash, and an ADC module. You must program these tiny microcontrollers, just as you do with their big brothers. To program these microcontrollers, you need the MCLR, two I/O pins (data and clock), and supply pins (VCC and GND). To enter programming mode, you need MCLR and supply. Because the microcontroller must differentiate between normal and programming mode, the MCLR pin usually reaches a voltage of approximately 12V to enter programming mode. There after, in normal operation, you can configure the MCLR pin either as an external reset or as an input-only pin.

This design uses one pin for analog input and the other three as outputs. The design thus requires an additional output. For that reason, this circuit uses the MCLR pin as an output. For simplicity, Figure 1 shows only the GP3/MCLR output circuit. To allow the GP3/MCLR pin to act as an output, the circuit uses the configurable weak pull-ups that this microcontroller offers. The selected function for the GP3/MCLR pin is input, and you must enable the global weak-pullup bit in the microcontroller’s configuration word. Although you cannot individually configure weak pull-ups, this inability is not a problem because you configure all other pins as analog inputs or digital outputs.

The weak pull-ups have a resistance of 20 to 150 kΩ, depending on supply voltages, so this circuit uses transistor Q1 to drive higher loads, such as the depicted LED. R1 drives the transistor off when you deactivate the pullups. Because the transistor’s gate is resistance- driven, the maximum toggle frequency depends on the chosen transistor. The worst-case scenario occurs when you need to switch off Q1. R1 and Q1’s gate-to-source capacitance determine the transistor’s switch-off time. Programming voltages for the MCLR pin are about 12V. Therefore, Q1 must withstand a gate-tosource voltage higher than this value. This design uses a MOSFET having a ±18V withstand voltage. For this reason, you should not use digital MOSFETs. You can use this circuit with other PIC microcontrollers and with most RS08KA family microcontrollers from Freescale.


 

Our Sponsors



Ads by Google