Use the MCLR Pin as an Output with PIC Microcontrollers

Microchip PIC10F222 2N7002

,

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 is particularly true in small designs using microcontrollers with eight pins or fewer. This Design Idea employs the Microchip 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 12 V to enter programming mode. Thereafter, in normal operation, you can configure the MCLR pin either as an external reset or as an input-only pin.

Добавление MOSFET и соответствующих цепей к входному контакту MCLR микроконтроллера PIC превращает этот контакт в выход.
Figure 1. Adding a MOSFET and associated circuitry to a PIC microcontroller’s
MCLR input pin transforms the pin into an output.

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 pullups 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 pullups, this inability is not a problem because you configure all other pins as analog inputs or digital outputs.

The weak pullups 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 12 V. Therefore, Q1 must withstand a gate-to-source voltage higher than this value. This design uses a MOSFET having a ±18 V 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.

Materials on the topic

  1. Datasheet Microchip PIC10F222
  2. Datasheet Microchip 2N7002

EDN

You may have to register before you can post comments and get full access to forum.
EMS supplier