这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » FPGA » 为微控制器提供4到20mA回路的电路

共1条 1/1 1 跳转至

为微控制器提供4到20mA回路的电路

高工
2007-09-18 22:27:33     打赏

在制造业设备的控制领域中,4到20mA的电流回路普遍存在。离散逻辑、微处理器和微控制器可以很容易使用控制方案的数字部分,例如:限制开关、按钮和信号灯。对初级微控制器而言, 4到20mA的输出接口存在问题。内置A/D转换器固然很好,但这样的设备对处理器来讲不经济。串行4到20mA芯片的确存在,但相对昂贵的,且需要串行设计,会使处理器价格过高。大部分低端芯片缺少专门的串行接口,并需要管脚编程。

  图1中的电路成本较低,不仅可以提供4到20mA的输出,而且提供数字反馈信号表征电流环中的明线。一个输出端口引脚用来输出电流,一个输入管脚用来监控回路线中的开路电流。这个电路的运行不需要电流环的开环反馈部分,为节省成本可省略这部分。

  电路由微处理器中简单的定时器输出驱动。定时器的占空比决定着电路的输出电流。第一个运放信号前端的RC网络调制来自处理器的脉动序列,以便运放认定其为直流电压。另外,这个网络确保即便输入接地时,最小输入电压也接近100mV,。当NPN晶体管Q1关闭时,最小电压确保第一个运放的反馈回路不会折回正极去。如果使用双极性供电,晶体管会有额外的电压在地电压下摆动,保 
持其处于导通区而不被关断。NPN型晶体管Q1的射极电阻决定电流范围。微控制器由5V电压驱动,输出电流为20mA。而输入接地的输出电流小于1mA。12.5%的占空比驱动4mA的电流回路,显示了整个范围上的线性控制。尽管这并不是强制的,但大部分电流回路都有接地回路。第二个运放的目的是提供电流源,而不是前端电路的电流减小,提供接地回路。因此,PNP型晶体管Q3提供高位驱动。双极结合晶体管Q1和Q3满足成本考虑,但也可以用MOSFET获得稍好的性能。

  电路的开关反馈部分使微处理器分辨线路中存在的错误条件。处理器可执行报警,关机或其他控制功能来减少安全隐患。当开环情况发生时,Q3通过射-基极连接隔离整个回路电流,而通过680Ω电阻接到运放。电压经过680Ω电阻并导通Q2,导致微处理器处于逻辑为1的反馈。注意到,对这类控制系统的“零”输出状态而言,开环回路需要至少1mA电流表征开路的功能,这个电流低于正常的4mA。

  指令改变的响应时间约为500毫秒,对大多数的电流回路控制设备是可接受的,例如控制阀门。如果选择的微处理器有内置A/D转换器,响应时间通过消除输入滤波网络的两个多阶幅值而减少。如果使用单电源拓扑,运放的选择就很重要。运放维持接近其负极、地或轨的稳定性是很重要的指标。

  英文原文:

  Circuit provides 4- to 20-mA loop for microcontrollers

  Edited by Bill Travis

  Robert Most, Dow Corning Corp, Auburn, MI -- EDN, 5/27/2004

  The 4- to 20-mA current loop is ubiquitous in the world of controls in manufacturing plants. Discrete logic, microprocessors, and microcontrollers easily cover the digital portions of control schemes, such as limit switches, pushbuttons, and signal lights. Interfacing a 4- to 20-mA output to a rudimentary microcontroller can be problematic. A built-in A/D converter would be nice, but such a device is sometimes unavailable in the "economy" line of these processors. Serial 4- to 20-mA chips exist but are relatively expensive and require serial programming and involve microcontroller overhead. Most lower end chips lack dedicated serial ports and require pin-programming.

  This circuit is a low-cost alternative that provides not only a 4- to 20-mA output, but also a digital feedback signal that indicates an open wire in the current loop (Figure 1). One output-port pin sets the current, and one input-port pin monitors an open circuit in the loop wire. The circuit does not require the open-loop feedback portion of the circuit for the current loop to operate; you can omit it for further cost savings.

The circuit derives its drive from a simple timer output in the microcontroller. The duty cycle of the timer determines the output current of the circuit. The input RC network in 
front of the first operational-amplifier signal conditions the pulse train from the processor, so that the op amp interprets it as a dc voltage. In addition, the network ensures that the minimum input voltage is close to 100 mV, even if the input is at ground potential. This minimum voltage ensures that the feedback loop of the first op amp does not fold back to the positive rail when you cut off npn transistor Q1. If you use a dual supply, the transistor has the additional voltage swing below ground potential to keep it in its active region and does not cut off. The emitter resistor of npn transistor Q1 sets the current span of the circuit. With a 5V drive from the microcontroller, the output current is 20 mA. A grounded input results in less than 1 mA. A duty cycle of 12.5% drives the loop at 4 mA and exhibits linear control to full scale. Although it may not be mandatory, most current loops prefer a grounded return path. The purpose of the second operational amplifier is to provide a current source, rather than the current sink of the first stage, and the grounded return path. Hence, pnp transistor Q3 provides this high-side drive. Bipolar-junction transistors Q1 and Q3 meet cost considerations, but you could also use MOSFETs for slightly better performance.

  The open-loop feedback portion of this circuit lets the microcontroller know that a fault condition exists on the line. The processor can then execute alarm, shutdown, or other control functions to mitigate possible safety concerns. When an open-loop condition occurs, Q3 shunts the entire loop current back through its emitter-base junction and through the 680Ω resistor to the op amp. The voltage developed across the 680Ω resistor turns on Q2, resulting in a logic-one feedback to the microcontroller. Note that the open loop requires at least 1 mA of current for the open indication to function, which is below the normal 4 mA—a "zero" output condition for this type of control system.


  Response time for a step change is approximately 500 msec, which is acceptable for most current-loop control devices, such as control valves. If the microcontroller you select has a built-in A/D converter, response time can decrease by a couple of orders of magnitude with the elimination of the input-filtering network. Op-amp selection is important if you use a single-supply topology. An operational amplifier that can maintain stability close to its negative, or ground, rail is an important asset.

 




关键词: 控制器     提供     回路     电路     电流     current    

共1条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]