News:

  • October 17, 2026, 07:58:12 PM

Login with username, password and session length

Author Topic: General Questions Concerning Modbus  (Read 14583 times)

RBPLC

  • Hero Member
  • *****
  • Posts: 586
General Questions Concerning Modbus
« on: March 29, 2021, 03:43:19 PM »
Couple of general questions concerning Modbus:

1) At present time MRX command is limited to 124 registers to read at a time. Is that limit because of the Modbus protocol or because of how the BRX works?
2) In general, does it take more time to execute the instruction or read all the registers? For example, if I use MRX to read 1 register or 124 registers at a time, is most of the time tied up in the open/close/processing of the instruction or the reading of the registers or does the time taken to complete the instruction primarily depend on how many registers are read at a time. I'm trying to read from very spread out registers in a device. I've got the MRX staged to process every register individually. Some of the registers are adjacent, some are not. The staging works but it's beginning to seriously get bogged down the more address I add to read from. Some of the registers are adjacent (within 124 registers) and I'm trying to determine if I should read fewer bigger blocks of registers to speed up comms.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3850
    • Host Engineering
Re: General Questions Concerning Modbus
« Reply #1 on: March 29, 2021, 04:03:39 PM »
Couple of general questions concerning Modbus:

1) At present time MRX command is limited to 124 registers to read at a time. Is that limit because of the Modbus protocol or because of how the BRX works?
Modbus specification limits.  Most devices are not servers with lots of RAM.  Think Modbus/RTU devices.

Quote
2) In general, does it take more time to execute the instruction or read all the registers? For example, if I use MRX to read 1 register or 124 registers at a time, is most of the time tied up in the open/close/processing of the instruction or the reading of the registers or does the time taken to complete the instruction primarily depend on how many registers are read at a time. I'm trying to read from very spread out registers in a device. I've got the MRX staged to process every register individually. Some of the registers are adjacent, some are not. The staging works but it's beginning to seriously get bogged down the more address I add to read from. Some of the registers are adjacent (within 124 registers) and I'm trying to determine if I should read fewer bigger blocks of registers to speed up comms.
Unless you are using Modbus/RTU over a 1200 baud modem  ;), always do as much as you can in one packet.  Time on the wire for Modbus/TCP is minimal compared to PLC scan overhead processing.  This assumes you have an online slave device.  TCP timeouts can be long (60 second default).

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: General Questions Concerning Modbus
« Reply #2 on: March 29, 2021, 06:18:53 PM »
If I was using one Program to perform reads and one program to perform writes to the same device (MRX in the read Program and MWX is the write Program), should I use separate devices for the MRX and MWX? Would this potentially speed up comms?

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3850
    • Host Engineering
Re: General Questions Concerning Modbus
« Reply #3 on: March 29, 2021, 08:24:34 PM »
No.  One Modbus Client per Server/Slave device is optimal.  Think telephones.  Once you connect to a specific slave, do as much talking as you can with that one client device.  If you have a second slave, use a second phone i.e. a Second Modbus TCP client device

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6177
  • Yes Pinky, Do-more will control the world!
Re: General Questions Concerning Modbus
« Reply #4 on: March 29, 2021, 08:38:04 PM »
Actually, if the remote server can process more than one request at a time, multiple clients might be faster. A Do-more server can process up to 16 sessions concurrently, so it would be faster there. It is dependent on your device.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: General Questions Concerning Modbus
« Reply #5 on: April 02, 2021, 02:52:21 AM »
Are there any issues with having multiple MRX (or MWX) commands using the same device, at the same IP address running continuously at a given interval at the same time ($On).

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3850
    • Host Engineering
Re: General Questions Concerning Modbus
« Reply #6 on: April 02, 2021, 08:43:13 AM »
Are there any issues with having multiple MRX (or MWX) commands using the same device, at the same IP address running continuously at a given interval at the same time ($On).
That works great.  The instructions just do round robin - once one instruction is done, the next one grabs the device and so on.  So they can all be ON.

RBPLC

  • Hero Member
  • *****
  • Posts: 586
Re: General Questions Concerning Modbus
« Reply #7 on: April 02, 2021, 08:57:18 AM »
Thanks.

Bolt

  • Hero Member
  • *****
  • Posts: 598
Re: General Questions Concerning Modbus
« Reply #8 on: April 02, 2021, 09:10:21 AM »
Are there any issues with having multiple MRX (or MWX) commands using the same device, at the same IP address running continuously at a given interval at the same time ($On).
That works great.  The instructions just do round robin - once one instruction is done, the next one grabs the device and so on.  So they can all be ON.
Does this apply to both RTU and TCP, or only TCP modbus devices?

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3850
    • Host Engineering
Re: General Questions Concerning Modbus
« Reply #9 on: April 02, 2021, 09:26:08 AM »
Does this apply to both RTU and TCP, or only TCP modbus devices?
Every MxX device works that way.  No problem.  Built-in Round-robin - all the inter-instruction coordination "just works"