Announcement

Collapse
No announcement yet.

Productivity PLC - Modbus RTU Chain

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts


  • Productivity PLC - Modbus RTU Chain

    Hello,

    I would have thought this would have been covered before, but search didn't reveal any concrete answers. I realize there are multiple ways to do what I'm doing, but I'm wondering if I'm over complicating things.

    I have five devices on a RS485 daisy chain that I want to pull multiple values out of using MODBUS RTU into a productivity plc. The Modbus Read instruction seems to be set up to only read from a single device at a time, so I guess I'm stuck building multiple instructions for each device and using ladder gates to control timing between read requests.

    My first question is, does anyone have an example of the most universally accepted and reliable way to perform this? I have managed to put something together using a counter and a timer, but it feels clunky. It does appear to prevent cross-talk and other serial gremlins, but if my timing is off, then I queries start coming back with garbage values. The whole thing feels like a hack job. The whole time I was assembling the program, a voice in the back of my head was screaming that there must be a better way to do this.

    My second question is, is there an instruction I'm missing that already handles polling multiple serial modbus devices for me? I'm guessing the answer is no. If so, is there any plans to implement this in the future?

    I'm mostly on P2000 PLC's, but I've recently tried a P1000.

    -FF






  • #2
    Yes you have to use multiple MRX instructions. However, you can use the autopoll feature inside the instruction to control the polling of the devices. If you have multiple devices you can use an offset in the instructions so that they do not poll at the same time. For instance you can set all 5 to poll at 100 msec and then set the 2nd with an offset of 20 msec, 3rd with offset of 40 msec and so on. There are timing charts in help topic P138 to show how the autopoll works.

    One thing that you need to look at if using multiple devices is the 485 port setup Request Response Delay. Most serial modbus devices do not respond as fast as we can query. So we end up making multiple requests before a device may respond. Not a real big deal if only reading since we do not buffer messages that are already in the queue, but for writes it can cause big issues with the buffer. Information on the Response/Request Delay setting with timing charts is in Help topic P282.

    Comment



    • #3
      If you wish to interlock manually just use a counter and the complete bits from each instruction to index the counter.

      Click image for larger version

Name:	interlock_1.JPG
Views:	2
Size:	215.3 KB
ID:	109616
      Click image for larger version

Name:	interlock.JPG
Views:	1
Size:	79.8 KB
ID:	109615
      Attached Files

      Comment



      • #4
        Only looking for the Complete bit doesn't allow for timeouts. If a timeout you may want to note that on that one device - maybe don't process the particular unit for a while, let the operator know etc. But continue on scanning the other devices. Without an processing of the timeout the whole chain locks up.
        thePLCguy

        Bernie

        Comment



        • #5
          Bernie,

          You are correct, this was a quick SHORT example of how to poll manually without a timer. If you are going to bring up all the things we need to monitor then this becomes a much longer thread.

          Comment



          • #6
            Originally posted by bcarlton View Post
            Only looking for the Complete bit doesn't allow for timeouts. If a timeout you may want to note that on that one device - maybe don't process the particular unit for a while, let the operator know etc. But continue on scanning the other devices. Without an processing of the timeout the whole chain locks up.
            Are you sure? The Help file P138 would imply otherwise. I'm referring to the timing chart on the bottom "Modbus Read Timing Chart without Automatic Poll Option - Timeout Bit Set from No Response."

            This chart would indicate that the "Complete" bit will turn on after the "In Progress" bit turns off, even if there is no successful communication and the timeout value has succeeded. Perhaps I'm interpreting the chart incorrectly?

            Comment



            • #7
              When Bernie says it does not allow for timeouts he means that it will continue to cycle through polling the instructions without a warning that one of the devices is timing out.(Each time you trigger the instruction it will reset the timeout and try again.) You would need to enter logic to monitor the timeout bits for each instruction or device. If you use a counter off of the timeout bit you can set it so that when you get X number of timeouts you stop polling that device for so many cycles and then try again. If you put in the example rungs I posted and do not put on a network with devices you will see you get a time out.
              Last edited by PSeries_Eng; 12-08-2017, 04:59 PM.

              Comment

              Working...
              X