2/15/2017 8:49 PM | |
Joined: 1/24/2009 Last visit: 3/29/2024 Posts: 85 Rating:
|
Hello, it is the 1st time that i need to establish a MODBUS communication between S71200 CPU1217 using CM1241 RS422/485 module and a NETWORK Analyzer instrument in order to read in my plc code values of voltage, current etc. I have prepared PLC as Master and the Analyzer as slave. Analyzer has no choice for MAster - Slave in it's confuguration menu but we will see... A critical problem is that it is not possible to make a real simulation in my office because the Analyzer is already installed at the plant. The scope is : using PLC as Master i need to to read contunuously 85 Dwords from the Slave = Analyzer with adress 31. There is no need to write to the slave anything, just to read. Attached the 3 networks where i have prepared the plc code in TIA Portal. 1. Is it necessary to declare adress to Master ? or need to declare somewhere that plc is the Master ? 2. I need after the end of a data transfer, to start a new request. Is my plc code ready to do that ? 3. Is it able to read all the 85 Dwords with each request or must i do a trick ? According to TIA help only 122 words per query is allowable to read. 4. In DATA_PTR udt i have declared the 85 Dwords that i have to read continously from the Slave - Analyzer. 5. In Modbus_Master module at input DATA_ADDR must be always the 1st memory position of Modbus 40001. Also in input DATA_LEN must put the value 170 ? And finally in input MB_ADDR must put the slave's adress ( 31 ) ? Sorry for large explanation. I hope this topic to help others too ! AttachmentMODBUS_ConnX.pdf (660 Downloads) |
2/17/2017 12:22 PM | |
Joined: 1/24/2009 Last visit: 3/29/2024 Posts: 85 Rating:
|
Hello again dear ola84, attached my code to read from slave 85 Dwords ( in 2 steps because of reading limit of 122 words ) Step 1 : reads the first 80 words ( 40 Dwords ) Step 2 : reads the rest 90 words ( 180 Dwords ). I kindly ask your time, to check it if everything works ok and if possible to suggest me a more efficient way to handle this communication. Do you see any erros in that code ? AttachmentModbus1.pdf (548 Downloads) |
2/17/2017 2:04 PM | |
Joined: 2/22/2016 Last visit: 8/28/2022 Posts: 140 Rating:
|
Hi Kosmous. If it's critical that you software works when you go to the plant, then I suggest you use another plc to simulate a modbus slave. AttachmentModbus1.pdf (539 Downloads) |
Please use the contact form in the link below if you will like to come in contact with me. I don't check personal messages frequently. |
|
This contribution was helpful to
1 thankful Users |
2/17/2017 3:04 PM | |
Joined: 1/24/2009 Last visit: 3/29/2024 Posts: 85 Rating:
|
Your suggestion are right In your comments Reset of REQ is making when DONE is true may be ? |
2/17/2017 4:13 PM | |
Joined: 2/22/2016 Last visit: 8/28/2022 Posts: 140 Rating:
|
There are many ways to Rome ! :) I am not sure if that will work or not, but I do know it will work if you set REQ false right away after the MB_MASTER block. I am worried that a new request will start before the new query parameters has been inserted. But I am not sure about this. If you have a rs-232/rs-485 converter, you can connect a PC to the modbus line and "lisen" to the telegram with a modbus software. One other thing you should be award of, is the endianness of your revived data. Modbus is easy and light protocol, but there are a lot of pitfalls ! |
Please use the contact form in the link below if you will like to come in contact with me. I don't check personal messages frequently. |
|
2/17/2017 4:52 PM | |
Joined: 1/24/2009 Last visit: 3/29/2024 Posts: 85 Rating:
|
thank you for your time, i will check it in real time during commisioning and come back to update the forum. |
Follow us on