一步步教你Modbus通讯,新手也能秒懂!
1.找一台带有RS485通讯模块的S7-1200PLC和一台V20变频器https://p9.toutiaoimg.com/img/pgc-image/fa954534568a43f5b1ee0269462e76d7~tplv-tt-shrink:640:0.image2.将RS485模块与V20变频器相连,接线的方法是红色线接P+,绿色线接N-https://p6.toutiaoimg.com/img/pgc-image/bc5a240849d34edca66af76fad6c2d79~tplv-tt-shrink:640:0.image
3.设置V20的变频器参数https://p3.toutiaoimg.com/img/pgc-image/dc7eab079cca44caa8899d3a25481038~tplv-tt-shrink:640:0.image
4.创建博途项目并上传S7-1200PLC的硬件组态https://p6.toutiaoimg.com/img/pgc-image/a8d6b3b690024f62b4c5a43d8148e09f~tplv-tt-shrink:640:0.image
https://p5.toutiaoimg.com/img/pgc-image/a74e086eb99b44e6b6568631bf27284d~tplv-tt-shrink:640:0.image
https://p6.toutiaoimg.com/img/pgc-image/8eabdb55159247e1afec0a4ad1b417a4~tplv-tt-shrink:640:0.image
https://p26.toutiaoimg.com/img/pgc-image/1e40942118f3488fbb7f89020d9ab428~tplv-tt-shrink:640:0.image
5.设置RS485模块的参数,模块的通讯参数要与V20设置的通讯参数要一致,我这里设置的是9600,8,偶。https://p9.toutiaoimg.com/img/pgc-image/13acb8eea4284c419572139ffe34f282~tplv-tt-shrink:640:0.image
6.添加Modbus通讯指令https://p5.toutiaoimg.com/img/pgc-image/dc39c422fc9d47bcb1f61e49996c9f66~tplv-tt-shrink:640:0.image
7.修改初始化指令背景DB里的mode参数为4https://p6.toutiaoimg.com/img/pgc-image/0b33d5de639e4a70a1ba6892c939ff4e~tplv-tt-shrink:640:0.image
8.程序测试,电机正常启动停止,其中modbus地址为40100的地址为命令源,047E为停止,047F为正转,0C7F为反转,地址为40100的地址为频率源,16#0-16#4000对应0Hz-50Hzhttps://p3.toutiaoimg.com/img/pgc-image/5890d7d150664361b7eeb1e94998da09~tplv-tt-shrink:640:0.image
9.可以通过观察模块的通讯指示灯可以观察通讯是否成功,如果TX,RX交替闪烁即为通讯成功。https://p6.toutiaoimg.com/img/pgc-image/d1bbe7129030421ca82d893a0f0e2eb6~tplv-tt-shrink:640:0.image
本来在潜水,看到LZ这篇矿石奇文,实在忍不住出来冒个泡泡:真TM天书啊! 这个类目最活跃了!赞一个! 路过打卡,为优质内容疯狂打 call 我先占个楼,等下再慢慢看~ 说得对!狠狠赞同,没毛病~ 蹲个后续,楼主记得更新呀,在线等挺急的~ 同款经历!我当初也这么过来的😂 赞同 + 10086,完全说出了我的想法! 笑不活了,评论区比正文还精彩!