S7-1200-1500案例之设备定时周期循环控制
[img=697.739990234375,437.97003173828125]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOw2HSUWKIcibGR9PPibtSvw2fkmfCOS8MhPW1HRXItSxfp6WL58DUE28HcYLVAqf0K9jy77xibtHTKQ/640?wx_fmt=png[/img]
相关软件:
1、编程软件:TIA-V15.1
2、仿真软件:PLC-SIM
实验任务:
1、手动时:按下启动按钮启动,按下停止按钮停止。
2、自动时:根据设置时间运行一段时间后停止;等待一段时间后继续运行,如此循环。
3、手、自动切换时,停止输出,条件不满足时停止输出。
注:本文程序仅供参考!!!
一、新建项目、添加硬件、设置系统时钟
[img=697.739990234375,378.1400146484375]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOw2HSUWKIcibGR9PPibtSvw2K6HZKVKkicHH87kGsQcsib70Hj82ttVjwocHEOzPYwDn7GeH9Xs5b6Mg/640?wx_fmt=png[/img]
二、新建FB块命名为:Timing Cycle _ Running (定义接口参数、编写程序)
1、定义接口参数
[img=697.739990234375,544.6200561523438]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOw2HSUWKIcibGR9PPibtSvw2447az27yHjSJZUz3WhibBrCMB2YDBMia4ibvy3C45h0aQQG0icqp7L8HOg/640?wx_fmt=png[/img]
2、编写程序
[img=697.739990234375,250.66998291015625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOw2HSUWKIcibGR9PPibtSvw2AHqZHbUvP3P3NUWnWD9kpt94pqy53ibOWzAwpeyia7C8OXPSdqdx5lWg/640?wx_fmt=png[/img]
程序段1
程序段2
[img=697.739990234375,232.5999755859375]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOw2HSUWKIcibGR9PPibtSvw2rDRrnB2DbVyK4icibRLzibIibrx4D9A10via7ic5T7WpppkHjSJwsz3bYbpQ/640?wx_fmt=png[/img]
程序段3
[img=697.739990234375,431.80999755859375]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOw2HSUWKIcibGR9PPibtSvw2rgUuP9ViazcTSh0VgKtQbpxIhxLawmagFPusvewzAOiaUjAbqLME7Cbg/640?wx_fmt=png[/img]
程序段4
[img=697.739990234375,476.4100036621094]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOw2HSUWKIcibGR9PPibtSvw2SHtm2YTiaotBgGjd6RQibfwC1wbSZNxF5Ownv6RSOicOFV61lWygC1m9Q/640?wx_fmt=png[/img]
程序段5
[img=697.739990234375,364.1400146484375]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOw2HSUWKIcibGR9PPibtSvw2OzsBibyKBh9P6PwyNs4wTZjndzGA4mlV0TAPMa2q2mZM0dqibaMeD14g/640?wx_fmt=png[/img]
程序段6
3、完整程序:
三、添加变量、新建FB块(Pump _ Control)、调用FB块(Timing Cycle _ Running)
1、添加变量:
[img=697.739990234375,406.94000244140625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOw2HSUWKIcibGR9PPibtSvw2vZoncl91WA7uibrJfByPsiabyyzicDraibjiau3CFWlvRJLjibKsFCueHA5Q/640?wx_fmt=png[/img]
2、新建FB块(Pump _ Control)、调用FB块(Timing Cycle _ Running):
[img=697.739990234375,329.94000244140625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOw2HSUWKIcibGR9PPibtSvw2xCGQ7Snc4vxNaxKmqDoLYsSEjoibbbFfkibNcWSeuTKhFSWsMvIA00xA/640?wx_fmt=png[/img]
3、完整程序:
[img=697.739990234375,600.239990234375]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOw2HSUWKIcibGR9PPibtSvw2SiaCMH9x1m6wNqoibbGib29qSkZ4icdglAa63g8rDfyicEkGBhd1stCzfJQ/640?wx_fmt=png[/img]
四、主程序调用、生成背景DB。
[img=697.739990234375,286.3399963378906]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOw2HSUWKIcibGR9PPibtSvw2z3tbGcINJcdZ7nAH91uawzvXFAefAnS4NNvDpldOVULTibiaMOQNRIGg/640?wx_fmt=png[/img]
主程序调用
[img=697.739990234375,356.8699951171875]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOw2HSUWKIcibGR9PPibtSvw2BHHWQiaQ4ZfT6ZrhCtibs0BKpw7icqXBicNGqbaIKWB7R67LPeLDwqInfg/640?wx_fmt=png[/img]
背景DB
[img=697.739990234375,312.79998779296875]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOw2HSUWKIcibGR9PPibtSvw2re2wz0F9fYmw2N0U4VgO08bsmnWibdNsRkbkZ4Ug0Ej584fzWfqXiaGg/640?wx_fmt=png[/img]
背景DB
五、下载测试:
[img=697.739990234375,687.010009765625]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOw2HSUWKIcibGR9PPibtSvw2PhOh4HRWwULXPXKx1fD1PLJq1ErY6JyMsH9Exkwlic1z5LMgW9XCFRw/640?wx_fmt=png[/img]
下载测试1
[img=697.739990234375,315.5400085449219]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOw2HSUWKIcibGR9PPibtSvw2ibialUbQKk9353ic691G2QFzUpk6hNswlPUHNhwoFHgA8aCTtLVia2L3ibw/640?wx_fmt=png[/img]
下载测试2
[img=697.739990234375,317.27001953125]https://mmbiz.qpic.cn/mmbiz_png/c8fkdKGFBIOw2HSUWKIcibGR9PPibtSvw2auQ2aUnRyMtcjIu8P6zbVwjnhLAdg5iczj5kbgeV2xGWvtR3sRWX1Ng/640?wx_fmt=png[/img]
下载测试3
注:本文程序仅供参考!!!
(参考文章:S7-1200-1500模拟量转换)
(参考文章:S7-1200-1500案例之设备轮询控制)
(参考文章:S7-200 SMART 案例之设备一用一备控制)
(参考文章:S7-200 SMART 案例应用之设备定时巡检)
(参考文章:S7-200 SMART 案例应用之设备轮询控制(冒泡排序))
(参考文章:S7-200 SMART 案例应用之设备定时控制)
(参考文章:S7-200 SMART 案例应用之倒计时)
(参考文章:S7-200 SMART 模拟量批量处理)
感谢您点赞、分享,给小编加鸡腿。
感谢您对小编的支持与赞助。
|