
上QQ阅读APP看书,第一时间看更新
第一部分 基本指令
项目1 用接通延时定时器产生断开延时、脉冲和扩展脉冲
项目要求
利用S7-200 SMART PLC的接通延时 (ON-delayed)定时器,产生断开延时(OFF-Delay)、脉冲(Pulse)及扩展脉冲(Extended Pulse)。
项目分析
接通延时定时器的基本工作原理如图1-1所示:使能端(IN)接通时开始定时,定时当前值大于等于预设值(PT)时(PT=1~32767),定时器状态位置位,即定时器对应的常开触点闭合,常闭触点断开;定时值达到预设值后,定时器继续计数,直到最大值32767为止;使能端断开,定时器状态位复位,当前值被清零。

图1-1 接通延时定时器及其时序图
编程示例
实现断开延时、脉冲和扩展脉冲的程序清单及注释如图1-2所示,主程序分为3个相对独立的部分,分别用来实现相应的功能。

图1-2 实现断开延时、脉冲和扩展脉冲的程序

图1-2 实现断开延时、脉冲和扩展脉冲的程序(续)

图1-2 实现断开延时、脉冲和扩展脉冲的程序(续)
经验技巧
S7-200 SMART PLC中有三种类型的定时器:接通延时定时器TON、保持型接通延时定时器TONR和断电延时定时器TOFF,有1ms、10ms和100ms三种分辨率,分辨率取决于定时器类型,如表1-1所示。要正确使用定时器,需要熟悉各种类型定时器的工作原理,控制定时器的启动、停止和复位是用好定时器的关键。
表1-1 定时器的特性
