6/8/2018 7:46 PM | |
Joined: 1/24/2009 Last visit: 3/29/2024 Posts: 85 Rating:
|
Hello again, i have established successfully 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 = SLAVE1 with adress 31. Now i need to communicate with 1 more slave let's name it SLAVE2 which is same device as SLAVE1. I will set a different adress ( 32 ) and i need your suggestion, how to add this new communication to my existing attached code. I need a new block like network 2 declaring the new connection details ? Could you put 1 comment in each network about the add ons that i have to do ? Th eproblem is that i have not the equipment available to make the simulation. I will test it on site. ------------------------------------------------------------------------------------------ AttachmentModbus 1 Master 1 slave.pdf (363 Downloads) |
Last edited by: The Helping Hand at: 6/11/2018 8:58:10 AMNew subject after splitting |
|
6/9/2018 5:29 AM | |
Joined: 2/22/2016 Last visit: 3/19/2025 Posts: 142 Rating:
|
Hi Kosmous. I previously made a library that address the challenge you describe.What is the name of the device you are communicating with? If your device is in the link bellow, then it should be pretty match strait forward to communicate with as many devices as you want: https://github.com/rexhip/rexhip/tree/master/station%20blocks If you would like to use the library, then I may help you to set it up. If you rather would like to modify your existing program, then I may also help you on that. https://github.com/rexhip/rexhip Kind regards |
6/10/2018 6:23 AM | |
Joined: 2/22/2016 Last visit: 3/19/2025 Posts: 142 Rating:
|
Hi. An email popped up in to mailbox about a new post on the tread, so I thought I will take a look at it. I do have an above average interest in modbus for Siemens plc's. :) The library solve the modbus in a generic way, so the developer doesn't need to think about sequence increment, resetting of req-bit, done and error flags, etc. With the library, the user only need to add another «mb_query()» and the library will take care of executing all the queries, one by one. I have compile together and attached the library with that specific profile for the ABB m2m. You can try to import the scl-file in to a new project and take a look at it, I can almost guarantee will work right away, because there few places a bug can be present in that specific profile. TIP: To import a scl file do the following steps:
Attachmentmb.zip (290 Downloads) |
6/10/2018 2:32 PM | |
Joined: 1/24/2009 Last visit: 3/29/2024 Posts: 85 Rating:
|
Hello ola84 great effort ! it seems to be the best solution especially when somebody have to communicate with more than 1 slaves. I will try it, but i can't test it before visitng the site. Could you give me some advices, how to illustrate the connection with the 2nd slave using the "manually" method , as the attached file ? For example, do i have to call again the communication blocks ? If you could put a comment to each network, would help my effort ! I will try to prepare both solutions for safety. Attachment1.docx (275 Downloads) |
Last edited by: kosmous at: 6/10/2018 2:35:13 PM |
|
6/11/2018 8:13 AM | |
Joined: 2/22/2016 Last visit: 3/19/2025 Posts: 142 Rating:
|
Hi. It actually just took me a few minutes to put the program together, so no worries. Keep in mind that the library require firmware >= 4.2. So if your plc doesn't have it, you should download it in advance. Also you need TIA portal >= v14. A tip at site: In the attachment you may see the sb-variable inside each of the data blocks for the ABB-devices. If everything is okay then the done counter will be running and the comm and exception counter will stay still. For your existing program you would need to extend the sequence with another step. In that step, the variable connected to mb_addr on mb_master, should be replaced by 32. It's similar to what you already doing, by making two different queries to the same device, just now you would need to change the mb_addr variable. If for some reason the library wouldn't work for you, then I can help you on your existing program. Kind regards |
6/12/2018 2:22 PM | |
Joined: 1/24/2009 Last visit: 3/29/2024 Posts: 85 Rating:
|
Dear ola84, i prepared attached the 2 last steps in order to read from the 2nd SLAVE address 32. Could you check if i change correctly the adress to value 32 and then back to 31 in order to restart reading the 1st slave ?..may be i could make the transission back to adress 31 at Network 1 ? As you said, the only value that have to be changed is the adress. All the other functions remain the same. In the 1st post is attached the code until step 7 = reading from slave 1 in 7 steps Attachment2nd Slave .docx (279 Downloads) |
6/16/2018 9:30 AM | |
Joined: 2/22/2016 Last visit: 3/19/2025 Posts: 142 Rating:
|
Good luck on commissioning. |
Follow us on