Skip to content

Modbus TCP Server - Read

Hello,

Is there a limitation on how many modbus blocks a client can read at a time? I am using sample Modbus TCP server example V11 and the read works for 1st block. As you can see the Query and Response in the below screenshot. However, the connection gets closed(Socket Error - C050, C228) for the 2nd block of data. I have 27 blocks with total of 1585 registers.

For the 2nd request, I do get a response for the coils, but no response for holding registers. Wondering if there is a limit on the server on how many blocks can be read at a time. Please help.

Comments

  • Here is the answer from the PLCnext Engineer support team:

    the max Query blocks for each client can be 10 (range 1-10)

    Does this answer the question?

  • edited October 2022

    Hello Martin,

    I believe the range applies to the TCP client function block in PLCNext. I am using an in-house modbus client and I did another test with 12 query blocks and it works fine.

    Failed case has 23 and 26 query blocks.


  • edited October 2022

    Typically you can read 125 WORDs (250 BYTEs) per request. And it can be up to 10 queued read blocks, but...

    Let we take a look at situation from another angle.

    MB TCP server (its realization for PLCNext Engineer) hold up 65536 registers for each inputs, coils, InputRegisters and HoldingRegisters types.

    It seems not very productive try to organize 65536 / 125 = 524 FC3 Read Holding Register blocks to get all HoldingRegisters available data from server.

    I'm sure you have to organize your data poll with some circular indexing, which can pass through all amount of data step by step. In this case you need only one FC3 block, array with offsets register addresses and pointer variable, which will iterate thought the offset array. Also some code to process FC3.xDone and FC3.xError state of poll iteration.

    Same for other registers types, read/write access, etc.

    Best regards

Sign In or Register to comment.