gzyueqian
13352868059
首页 > 新闻中心 > > 正文

使用MCLR管脚作为PIC微处理器的输出

更新时间: 2008-01-21 08:57:48来源: 粤嵌教育浏览量:1329

  为6管脚微处理器增加一个MOSFET,将复位/编程引脚转变为输出管脚。

  虽然微处理器制造商设法提供给设计人员精确合适的产品,但多一个输出管脚通常是必要的。这种情况在使用8管脚或更少管脚的小型设计时更加有效。本设计方案采用Microchip公司PIC10F222。PIC10F222有SOT23-6封装,提供三个I/O引脚,一个输入管脚,RAM、flash、和一个ADC模块。必须规划好这些微型处理器,就像那些大型微处理器一样。为给这些微处理器编程,需要MCLR、两个I/O管脚(数据和时钟)和供电管脚(VCC和GND)。为进入编程模式,需要MCLR和电源。因为微处理器必须区分正常和编程模式,而MCLR管脚通常达到约12V电压才进入编程模式。然后,在正常工作中,可以配置MCLR引脚为外部复位或仅作为输入引脚。

  本设计使用一个模拟输入和三个输出引脚。因此,本设计需要一个额外的输出引脚。出于这个原因,电路使用MCLR引脚作为输出。简单的说,图1只显示了GP3/MCLR输出电路。为允许GP3/MCLR管脚作为输出使用,电路使用微处理器提供可配置的弱上拉功能。GP3/MCLR管脚的可选功能为输入,在微处理器配置命令中,必须使能全局弱上拉位。虽然不能分别配置弱上拉,但是这不是问题,因为可以配置其余引脚作为模拟输入或数字输出。
           


  根据供电电压,弱上拉使用20到150 kΩ的电阻,所以这个电路使用晶体管Q1驱动更高的负载,例如所述的LED。当禁止上拉功能时,R1驱动晶体管关闭。因为晶体管门极为电阻驱动,锁存频率由所选的晶体管决定。坏的情形发生在需要关闭Q1的时候。R1和Q1的门源极电容决定了晶体管的关闭时间。

  MCLR管脚的编程电压大约为12V。因此,Q1必须经受门源极电压高于这个值。本设计使用能经受±18V电压的MOSFET。出于这个原因,不应该使用数字MOSFET。可以将这个电路用于其它PIC微处理器,对大多数Freescale公司的RS08KA系列微处理器都适用。

  英文原文:

  Use the MCLR pin as an output with PIC microcontrollers

  Adding a MOSFET to a 6-pin microcontroller transforms its reset/programming pin into an output pin.

  Antonio Muñoz, Laboratorios Avanzados de Investigación, Huesca, Spain, and Pilar Molina, Universidad de Zaragoza, Zaragoza, Spain; Edited by Charles H Small and Fran Granville -- EDN, 1/10/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 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 12V 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.

  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 o

  utput, 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 12V. Therefore, Q1 must withstand a gate-to-source 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.

免费预约试听课