Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: CReese on March 24, 2014, 12:51:51 PM

Title: MRX Read Size
Post by: CReese on March 24, 2014, 12:51:51 PM
Hello all,

The typical modbus read length for function code 3 should be 256 bytes. The MRX I would use in DoMore, however, limits the input to 125, and passing values by variable of >125 results in a failed read. Is there a reason I cannot read 128 words at a time? It's much more awkward to break up reads of data in 512 and 1024 words this way. I either read evenly in 64 word bunches (twice as many reads as I should need), or break it up into uneven quantities.

Thanks,
Colin
Title: Re: MRX Read Size
Post by: Controls Guy on March 24, 2014, 01:04:20 PM
I was under the impression the entire PACKET had to be under 256 bytes.  I've never seen a setup that would do 128 registers in a shot, unless they could and I just didn't realize it.  I usually break up reads of large contiguous blocks in 100-register groups.
Title: Re: MRX Read Size
Post by: CReese on March 24, 2014, 01:11:43 PM
I CAN do that, but it makes it more difficult to set up loops that way. A 512 words would be split up into 100,100,100,100,100,12, or 64,64,64,64,64,64,64,64. Either is non-ideal. 16 reads to get 1024 words is a bit excessive.
Title: Re: MRX Read Size
Post by: Controls Guy on March 24, 2014, 01:13:06 PM
So have you seen other masters and slaves that will do 128 registers in one transaction?
Title: Re: MRX Read Size
Post by: CReese on March 24, 2014, 01:15:00 PM
After reading some more, it does appear the maximum data frame length is 250 bytes after the frame metadata. Boo.
Title: Re: MRX Read Size
Post by: BobO on March 24, 2014, 02:37:57 PM
The limit is determined by the Modbus specification, which was almost certainly chosen to allow the entire packet (with overhead) to fit in 256 bytes.
Title: Re: MRX Read Size
Post by: franji1 on March 24, 2014, 04:33:10 PM
After reading some more, it does appear the maximum data frame length is 250 bytes after the frame metadata. Boo.
1 WORD REGISTER = 2 BYTES.  250 / 2 = 125
There is a method to our madness  ;D

fyi...
The maximum number of registers you can WRITE? 123
The maximum number COILs you can READ? 2008
The maximum number of COILs you can WRITE? 1976
(less overhead in a slave's read response data packet than in a master's write data packet)

These are not Do-more limitations, but Modbus protocol limitations.
Title: Re: MRX Read Size
Post by: CReese on March 24, 2014, 07:21:02 PM
I'm getting 125 just fine. It was a misread of the protocol on my part for sure.
Title: Re: MRX Read Size
Post by: CReese on March 24, 2014, 07:22:35 PM
1 WORD REGISTER = 2 BYTES.  250 / 2 = 125

Yes. I stated this above. I understand data size.

Quote
The maximum number of registers you can WRITE? 123
The maximum number COILs you can READ? 2008
The maximum number of COILs you can WRITE? 1976

125 registers works fine.