7/26/2017 11:47 AM | |
Joined: 9/2/2012 Last visit: 6/3/2019 Posts: 176 Rating:
|
Hi. (TL;DR below) I have re-written our modbus code several times after trying several ways. There is always a problem with MB_CLIENT. First we have a local variable with TCON_IP_v4 structure, where we set ip and port, so far so good. Currently we have a step-by-step function that for example #step=1, we put data in the _MB_CLIENT
This translates to we want to read 2 registers in the register 2000 (and 2001) from modbus unit 1. Now i have an array 1..10 registers i want to read out one by one, so i have this #RegisterIdx local variable that i increment in the end after i get _MB_CLIENT.MB_ERROR or _MB_CLIENT.MB_DONE. I have been reading up alot today, and i get very conflicting information on how to use the MB_CLIENT block.
The modbus device we are trying to communicate with is a Schneider-Electric PowerLogic EGX100 / Compact NS and Masterpact NT/NW, these units meassure power consumption of varying devices in the cabin, like welding robots or conveyers. I like to belive that i now grasp how to communicate via the MB_CLIENT, but it only seems to work on some occations. Not to make the programming too complex, i have tried to only make a look 1-10 and ONLY communicating with 1 MB unit (instead of looping thru 1-10 for each 1-10 units). The plc on my desk has now been running for 60 minutes, i have 2 good reads, and almost 600 errors
-- Most help i find, is for s7-1200, which does not work as in s7-1500. Somewhere i also read that using a local variable for the output of done/error etc, and then uses that local variable, would trigger something to revaluate the instance db for mb_client of the mb_done/mb_error. -- LT;DR: How is the s7-1500 mb_client be handled when it comes to trigger REQ, populate data, using local variables for done/error/busy signals (outputs of mb_client). |
Last edited by: FuriousRage at: 7/26/2017 11:48:23 AM |
|
Follow us on