Modbus frame size

B

Thread Starter

Bin

Hi, I am a newbie for Modbus. For my project, I need to transfer a large amount data between devices by Modbus protocol.

My question is whether by any chance I can use frame size larger than 256 bytes.

What are the related issues to increase the frame size to an arbitrary number?

Many thanks!

Bin
 
Hello,

The quick answer is no.

"A protocol is a set of rules which is used by computers to communicate with each other across a network."

The MODBUS protocol defines a maximum message size of 255 bytes.

Now, if you are in control of both ends of the communication line you can do whatever you want. If you intend to communicate with others using MODBUS then we are back to the 'no' answer.

Good luck,

Mark
http://www.peakhmi.com/
 
No! If you notice in the Function Code 3 slave response the 3rd byte is the byte count of the data bytes to follow, not including the 2 byte CRC. A byte can have a max value of 0xff (255) but most Modbus implementations have a max data byte count of 240 data bytes plus ADDR, FCN, CNT, CRC1 and CRC2, a total of 255 bytes.
 
If you change the protocol it won't be Modbus anymore and it won't talk to Modbus devices. If that's not a problem, then go right ahead. Just don't call it Modbus because it won't *be* Modbus. It will be your own custom protocol that just happens to have a lot of similarities to Modbus. If you are going to do that however, then why not just use an existing protocol that is intended for transferring large blocks of data?

Modbus is optimised for frequent transfers of "small" blocks of data (e.g. up to 2000 coils, or 125 registers). When we say "small" though, that is a relative term. It's small in terms of a video stream, but it's large in terms of industrial control. There aren't too many machines with 2000 valves in a single valve bank.

As to what would be a good solution for what you are doing, you haven't provided enough information to make any recommendations. I hope the above has answered your question though.
 
J

Jerry Miille

If you are going to use Modbus, you are limited to a maximum of 255 bytes of data per message because a Modbus response message includes a "Byte Count" parameter that is a single byte long.

There are some variations around that use a word (16 bits) for the Byte Count field but now you have a protocol that is no longer "Modbus".

Jerry Miille
Miille Applied Research Co., Inc
http://www.miille.com/
 
Thanks very much for your reply.

In my case, I am in control of both ends.

I need to transfer a large amount of sample data (6kbytes/sec) between client and server.

If I follow the frame size limit in Modbus protocol, I have to wake up communication thread in the client side more often. This may give some troubles for the client firmware.

Is there any recommended protocol I can use for transfer large amount of sample data?

Bin
 
Hi,

Since you are controlling both ends it might be advantageous to create your own.

FTP might be a good one.

Can you compress the data before you send it?
Are you going to have any firewalls to pass through?
Is the data transmitted 24/7?
Can the data be sent using UDP or must it be TCP?
Is the data always the same size?

Good luck,
Mark
http://www.peakhmi.com/
 
Thanks very much for all your reply.

In my case, I am in control of both ends.

I need to transfer a large amount of sample data (6kbytes/sec) between client and server.

If I follow the frame size limit in Modbus protocol, I have to wake up communication thread in the client side more often. This may give some troubles for the client firmware.

Is there any recommended protocol I can use for transfer large amount of sample data?

Bin
 
It's hard to suggest a good alternate protocol without knowing a lot about the application. So far, all we know is that you want to connect two "things" together. However, given that you control both ends of the connection and don't need to talk to anything else, then you might simply make up your own protocol tailored to do only what you need. That can be a lot less work than implementing an existing general purpose protocol.
 
The answer is NO

The volume and speed of data you wish to exchange between both the client and the server are irrelevant.

If both sides are MODBUS Capable devices/equipment, then the data you want to exchange will have to be of TRUE MODBUS Nature.

All you need to do is to start the data exchange between both equipment and let the Modbus Protocol handle the size and frame issue.

In one of your statements, you said that you "wish to use MODBUS Protocol to exchange data between some Master and some Slave. This is fine. But this also you can not just "WISH" for.

You only may be able to do this if both devices are MODBUS Capable Devices.

If both sides are of "Neutral Nature", meaning that you can condition it for use by any Protocol, then you may need to read and understand ALL available protocols and then you may decide on the one that suits your requirement.

Selecting and opting for a Protocol to use can not be built on "WISHES" .. this should be built on "STUDIES".

If you are (as you claim) new to MODBUS, then you need to read, learn and understand how it works. The 255 Byte length of message of MODBUS is not a limitation. It is how it is built.

I emphasize one more time, If both equipment are MODBUS Capable, then you do not need to worry about how it is done. Just set up the communication and it will look after itself.

You do not need to re-invent the wheel.
 
What happen if you request more than 125 registers?

will Modbus device send out two response frames for the single request?
 
Thread starter Similar threads Forum Replies Date
G Modbus 1
R Modbus 1
J Modbus 5
J Modbus 7
M Modbus 16
Top