S7-200 SMART案例之设备手/自动控制
本文使用软件:STEP7 Micro/WIN SMART V2.7
硬件:CPU-SR20(IP:192.168.2.1)
控制要求:
1、设备实现手动控制和自动控制;
2、设备记录累计运行次数和累计运行时间;
注:程序仅供参考!!!
一、设备手/自动控制:(新建子程序、定义变量、编写程序、下载测试)
1、新建子程序(Man Auto Ctrl),定义变量表
[img=561.6099853515625,722.409912109375]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIP3b9O1BLS1icQjkRDibic5HiaWRrDC6xrGTGHzpGqyFsLJQXIZdYVBvvKlGDfMRowI8O4BBC9WL99z7w/640?wx_fmt=png[/img]
定义变量表
2、编写程序:
[img=697.739990234375,331.94000244140625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIP3b9O1BLS1icQjkRDibic5HiaW7opJmBg5prObapTI9ezRzJicSIibzMcNziaCalCpopaKzHEmjou9RiaJxQ/640?wx_fmt=png[/img]
引脚说明
[img=697.739990234375,794.0800170898438]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIP3b9O1BLS1icQjkRDibic5HiaWUBcgxWBPKeQibTGZaiadDMWOExJYQR6TB2usOMQABib2YEQia8fC79TFjw/640?wx_fmt=png[/img]
沿信号
[img=697.739990234375,188.07000732421875]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIP3b9O1BLS1icQjkRDibic5HiaWRjAdRogPUP7BZtBMsFzofzibqefTicmnccPyJ8uQEsucl9kBDNuxGpeA/640?wx_fmt=png[/img]
设备手/自动控制
[img=697.739990234375,122.739990234375]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIP3b9O1BLS1icQjkRDibic5HiaW7ciaiaicib2A4hkm1k6am8oibQjAHpDHLkwLUZT6rSTALjnTJt3O6WOSRjw/640?wx_fmt=png[/img]
软故障判断
[img=697.739990234375,323.3399658203125]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIP3b9O1BLS1icQjkRDibic5HiaWiau38SA8Nccv2mozskgNonhAVqFmofiaQQtMEQVEeSLOF4Dq574zfnvg/640?wx_fmt=png[/img]
软故障及复位
[img=597.010009765625,270.0]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIP3b9O1BLS1icQjkRDibic5HiaW7u97C3WQmvkHqPcXIAE1ZxzvRyicSCDj9U4cyBWRpKiaQMLrwh7QDibbQ/640?wx_fmt=png[/img]
输出控制
[img=697.739990234375,452.40997314453125]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIP3b9O1BLS1icQjkRDibic5HiaWOOezpX7JVo7CuMDribo5VKx209TXJZ274NcMENQaMIic5IfUKJ2mAJTw/640?wx_fmt=png[/img]
设备累计运行次数、累计运行时间
[img=697.739990234375,320.20001220703125]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIP3b9O1BLS1icQjkRDibic5HiaWLRx4jlLS324YxE3te1p3xHN8IUbicpcg3njgkCicjw2WhQJbWd1ib5zMQ/640?wx_fmt=png[/img]
冒泡排序时间计算
完整程序:
3、调用、下载测试:
[img=685.010009765625,741.010009765625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIP3b9O1BLS1icQjkRDibic5HiaWlZzFiaF69iasSOb0JxEibfZ2SrMeJhfFlYkc20K4o3UY7ag7zNFrFbibVA/640?wx_fmt=png[/img]
下载测试1
[img=625.010009765625,713.010009765625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIP3b9O1BLS1icQjkRDibic5HiaW4vno8ZFNWXYpK1M2rbvokM1dJzStzqLibc2y7o0UqInXodjDDGJFAaA/640?wx_fmt=png[/img]
下载测试2
[img=696.010009765625,737.010009765625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIP3b9O1BLS1icQjkRDibic5HiaWbXJhvMEYd5XsrNCwv8E4GEke0Ytic8IbHxyfgeDCibHSRhmLkNHVNRMw/640?wx_fmt=png[/img]
下载测试3
[img=692.010009765625,707.010009765625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIP3b9O1BLS1icQjkRDibic5HiaWDDMyuGibZdv1uk0oXSTBeGw5mZ8qXSpwdLPMXsPg1MEL9rzAQzxSvhA/640?wx_fmt=png[/img]
下载测试4
4、操作演示:
video: https://mp.weixin.qq.com/mp/readtemplate?t=pages/video_player_tmpl&action=mpvideo&auto=0&vid=wxv_3395575508414775313
注:程序仅供参考!!!
(参考文章:S7-200 SMART 基础篇之子程序应用)
(参考文章:S7-200 SMART 案例之正反转控制)
(参考文章:S7-200 SMART获取数组最大值最小值)
(参考文章:S7-200 SMART 基础篇之自定义库指令) |