PHP Classes

Different values if take different range

Recommend this page to a friend!

      ModbusTcp  >  All threads  >  Different values if take different range  >  (Un) Subscribe thread alerts  
Subject:Different values if take different range
Summary:Registers show different values depending of the range of regist
Messages:2
Author:alekline
Date:2010-02-14 03:57:19
Update:2010-02-14 11:12:43
 

  1. Different values if take different range   Reply   Report abuse  
Picture of alekline alekline - 2010-02-14 03:57:19
Hello everybody..

I don't know if I am using the class in a wrong way or if this is a Modbus Protocol limitation, but I just realized that the registers show different values depending of which range of registers you are querying.

I was querying different Modbus devices in my LAN and even the IP provided by the author (195.6.140.177) and I got the same results.

When I query 20 HoldingRegisters from any Modbus IP Device, I get a set of values (one for each memory register) that are different of those values that I get when I query a larger range of values (30 or 40 registers).

To be more and better explained, please see the values I got while doing queries to the IP address 195.6.140.177 in different range of Registers:

All the queries were to the same IP (195.6.140.177), and the same device (device 5) starting from Address 400001, but 400001 has a different value in each case. the same thing its happening with other Registers.

Querying from start Address 400001 and count 20 Registers:

Array
(
[400001] => 4 - Reading 20 registers, 400001 has "4" as value; when reading 30 registers it has "5"; when reading 40 registers it has "4".
[400002] => 0
[400003] => 0
[400004] => 0
[400005] => 0
[400006] => 0
[400007] => 5633 - Reading 20 registers, 400007 has "5633" as value; when reading 30 registers it has "5633"; when reading 40 registers it has "5120".
[400008] => 0
[400009] => 0
[400010] => 0
[400011] => 1
[400012] => 71
[400013] => 0
[400014] => 34
[400015] => 0
[400016] => 0
[400017] => 0
[400018] => 195
[400019] => 919
[400020] => 0
)


Querying from start Address 400001 and count 30 Registers:

Array
(
[400001] => 5 - Reading 20 registers, 400001 has "4" as value; when reading 30 registers it has "5"; when reading 40 registers it has "4".
[400002] => 0
[400003] => 0
[400004] => 0
[400005] => 0
[400006] => 0
[400007] => 5633 - Reading 20 registers, 400007 has "5633" as value; when reading 30 registers it has "5633"; when reading 40 registers it has "5120".
[400008] => 0
[400009] => 0
[400010] => 0
[400011] => 1
[400012] => 71
[400013] => 0
[400014] => 34
[400015] => 0
[400016] => 0
[400017] => 0
[400018] => 195
[400019] => 919
[400020] => 0
[400021] => 34552
[400022] => 309
[400023] => 20
[400024] => 0
[400025] => 0
[400026] => 0
[400027] => 0
[400028] => 0
[400029] => 28
[400030] => 8250
)

Querying from start Address 400001 and count 40 Registers:

Array
(
[400001] => 4 - Reading 20 registers, 400001 has "4" as value; when reading 30 registers it has "5"; when reading 40 registers it has "4".
[400002] => 0
[400003] => 0
[400004] => 0
[400005] => 0
[400006] => 0
[400007] => 5120 - Reading 20 registers, 400007 has "5633" as value; when reading 30 registers it has "5633"; when reading 40 registers it has "5120".
[400008] => 0
[400009] => 0
[400010] => 2
[400011] => 1
[400012] => 71
[400013] => 0
[400014] => 34
[400015] => 0
[400016] => 0
[400017] => 0
[400018] => 195
[400019] => 919
[400020] => 0
[400021] => 34552
[400022] => 309
[400023] => 20
[400024] => 0
[400025] => 0
[400026] => 0
[400027] => 0
[400028] => 0
[400029] => 28
[400030] => 9000
[400031] => 15
[400032] => 0
[400033] => 0
[400034] => 0
[400035] => 0
[400036] => 0
[400037] => 0
[400038] => 0
[400039] => 0
[400040] => 0
)


Is there a limitation of the range of values that I can query ?

which limitation is it?

What other parameters should I have to take in acount when doing these queries?

  2. Re: Different values if take different range   Reply   Report abuse  
Picture of fuchs yves fuchs yves - 2010-02-14 11:12:43 - In reply to message 1 from alekline
Mmmm ...strange, I had never this issue !
What kind of device you query out ? A PLC ?
For me the values are changing in the device between the reading queries.
You can read up to 125 registers in one query. This is normaly a limitation in the modbus specification and I have also fixed in this class.
But some provider of modbus devices overcome this limitation, sometime less as 125 registers sometime more..depending of the device.

Yves FUCHS