7/28/2019 1:25 PM | |
Joined: 6/30/2017 Last visit: 10/18/2024 Posts: 13 Rating:
|
Dear, Im new i PCS7, and i need to write a program for modbus RTU master reading 5 slaves. I seen that there are multiple solution but i decided to use FB8 and FB7 to sent and to receive data with CP341. If one of experts can look at breaf code writen in PCS7 v9.0 pictures attached OB32 - cyclic interrupt for changing the send data to slaves. Every 5s the DB10 data is changed to corespond to needed slave (slave ID, function code, reg offset and number of registar) FC10 - calling of FB8 and FB7 in OB1 FB8 - send data to slave, all input data is the same, because OB32 is changing the DB10 wich contain slave information. FB7 - Only DBB_NO is changing for data storage in DB11. I will keep receive data bit always ON. I use only few bits. One for sent request M10.0 . Sending is done M10.1 and receiving complited NDR M10.6 I reset bit M10.0 when negative edge is detected on M10.1. Is this configuration possible, because i cant test the program, and is it possible to use NDR bit to detect if slave has failed to respond? I can only test OB32 and its changing the slave parametars every 5s like i wanted. At the end of OB32 i am seting one bit that tells me when OB32 changed the data. This bit triggers the send bit on FB8. which is reset when compite reqest bit is ON. That way im calling another slave every 5s. Regards and Thx AttachmentPictures.zip (169 Downloads) |
7/28/2019 2:35 PM | |
Posts: 3093 Rating:
|
Just take a look at the attached page of the Modbus Master manual. Regards, |
This contribution was helpful to
1 thankful Users |
7/28/2019 5:03 PM | |
Joined: 6/30/2017 Last visit: 10/18/2024 Posts: 13 Rating:
|
Didnt find this manual before. It seems like a good one. Thx |
7/29/2019 8:32 AM | |
Posts: 3093 Rating:
|
Hello, Regards, |
Follow us on