定时器、计数器及应用1.定时器的使用Y430T450T450K3Y430X400T450X4002S3SM100T450T450K3X400M100Y430X401X400X401Y4303S2.计数器的使用C460X400K3X401M71Y430RSTOUTC460X400X401Y430LDX401ORM71RSTC460LDX400OUTC460K3LDC460OUTY430a)C460C460X400K3X401Y430RSTOUTC460LDX401ORC460RSTC460LDX400OUTC460K3LDC460OUTY430X400X401Y4301个扫描周期b)C460X400K3X401C460Y430RSTC460LDX401ORC460RSTC460LDX400OUTC460K3LDC460OUTY430X400X401Y4301个扫描周期C460c)3.定时器、计数器的典型电路T450T450K3Y430T450①脉冲发生器3s一个扫描周期Y430T450T451T451K5X400T450Y430K8X400T450Y4308S5ST总=T1+T2=8+5=13sa)②定时器的扩展C460X400K100M71Y430RSTOUTC460M72T总=T×C=0.1×100=10sb)②定时器的扩展T总=(T+t)×C≈10×150=1500st:一个扫描周期C460T450K150M71Y430RSTOUTC460T450T450K10c)②定时器的扩展③震荡电路(闪烁电路)T450T450K5T451T451K35s3sT450a)5s3sT450b)T450T450K1T450Y430Y430T451K0.6T4510.6s0.4sY430⑤计数器的扩展C460X400K500C460M71RSTOUTC461C460K300M71Y430RSTOUTC4615S3S负载1负载2控制开关练习1T450T450K5X400Y430T451K3T451Y431练习1控制开关:X400负载1:Y430负载2:Y4315S3S启动停止负载1负载2负载3练习2K5M100T450X400M100X401Y430T451T450Y431Y432T451K3练习2启动:X400停止:X401负载1:Y430负载2:Y431负载3:Y432练习35S3S启动停止负载1负载2K5M100T450X400M100T450Y430T451T450Y430T451Y431T451Y431X401K3练习3启动:X400停止:X401负载1:Y430负载2:Y431练习4启动按钮停止按钮负载C460X400K3X401M71Y430RSTOUTC460练习4启动:X400停止:X401负载:Y430练习5启动按钮停止按钮负载1负载2C460X400K3X401M71Y430RSTOUTC460C461C460K2M71Y431RSTOUTC461X401X400练习5启动:X400停止:X401负载1:Y430负载2:Y431练习6用一个按钮控制组合吊灯三档亮度的控制功能如下图所示,试编制程序并调试。控制按钮灯1灯2灯31234C460X400K1C463M71RSTOUTC461X400K2C460Y431RSTOUTC461M71C463Y430C462X400K3C463M71RSTOUTC463X400K4C462RSTOUTM71C463Y432练习6控制按钮:X400灯1:Y430;灯2:Y431灯3:Y432三、通风机运行监视1.控制要求三台通风机用各自的起停按钮控制其运行,并采用一个指示灯显示三个风机的运行状态:(1)三台风机都不转,指示灯显示平光;(2)一台风机运转,指示灯慢闪(T=2s);(3)两台以上风机运转,指示灯快闪(T=1s);通风机运行监视演示2.I/O设置输入:X400监视开关X401风机1起动按钮X402风机1停止按钮X403风机2起动按钮X404风机2停止按钮X405风机3起动按钮X406风机3停止按钮输出:Y430状态指示灯Y431风机1Y432风机2Y433风机33.编制梯形图I/O设置输入:输出:X401风机1起Y430指示灯X402风机1停Y431风机1X403风机2起Y432风机2X404风机2停Y433风机3X405风机3起X406风机3停X400监视开关Y431M100Y432Y433Y431Y432M101Y431Y433Y432Y433M100M102M101X401X402Y431Y431X403X404Y432Y432X405X406Y433Y433≥2=0=1T=1ST=0.4S监视开关指示灯X400Y430T452M102M101M100T450T450T451T451T450K0.5K0.5T453T452T452T453K1K1都不转2个以上转1个转慢快