title: Pymodbus read holding registers
body: <p>I was assigned to perform the task without any documentation. I have a problem with reading data from MODBUS. This is the script that I was able to create:</p>
  
  <pre><code>from pymodbus.constants import Endian
  from pymodbus.payload import BinaryPayloadDecoder
  from pymodbus.payload import BinaryPayloadBuilder
  from pymodbus.client.sync import ModbusTcpClient
  
  client = ModbusTcpClient('X.X.X.X')
  connection = client.connect()
  
  request = client.read_holding_registers(12606,2)
  result = request.registers
  decoder = BinaryPayloadDecoder.fromRegisters(result, Endian.Big, wordorder=Endian.Little)
  print "Counter1: %0.2f" % decoder.decode_32bit_float()
  
  request = client.read_holding_registers(12482,2)
  result = request.registers
  decoder = BinaryPayloadDecoder.fromRegisters(result, Endian.Big, wordorder=Endian.Little)
  print "Counter2: %0.2f" % decoder.decode_32bit_float()
  
  client.close()
  </code></pre>
  
  <p>Everything looks fine, But the data on the counter is different from those in the script for example:</p>
  
  <pre><code>Value on the counter : 39558853.30 (value is decimal)
  Value from the script: 58853.30
  (value is decimal)
  
  Read input registers (HEX): E54D 4765
  </code></pre>
  
  <p>And this is how the address documentation looks like"</p>
  
  <pre><code>P   12458       Q2  4\DW12458 = 1\ND20_Q2\P(F)
  Q   12462       Q2  4\DW12462 = 1\ND20_Q2\Q(F)
  S   12466       Q2  4\DW12466 = 1\ND20_Q2\S(F)
  I   12470       Q2  4\DW12470 = 1\ND20_Q2\I(F)
  U   12474       Q2  4\DW12474 = 1\ND20_Q2\U(F)
  f   12478       Q2  4\DW12478 = 1\ND20_Q2\f(F)
  EP_POB  12482       Q2  4\DW12482 = 1\ND20_Q2\EP_POB(F)
  EP_ODD  12486       Q2  4\DW12486 = 1\ND20_Q2\EP_ODD(F)
  EQ_IND  12490       Q2  4\DW12490 = 1\ND20_Q2\EQ_IND(F)
  EQ_POJ  12494       Q2  4\DW12494 = 1\ND20_Q2\EQ_POJ(F)
  THDVL1  12498       Q2  4\DW12498 = 1\ND20_Q2\THDVL1(F)
  THDVL2  12502       Q2  4\DW12502 = 1\ND20_Q2\THDVL2(F)
  THDVL3  12506       Q2  4\DW12506 = 1\ND20_Q2\THDVL3(F)
  THDIL1  12510       Q2  4\DW12510 = 1\ND20_Q2\THDIL1(F)
  THDIL2  12514       Q2  4\DW12514 = 1\ND20_Q2\THDIL2(F)
  THDIL3  12518       Q2  4\DW12518 = 1\ND20_Q2\THDIL3(F)
  UL1 12522       Q2  4\DW12522 = 1\ND20_Q2\UL1(F)
  UL2 12526       Q2  4\DW12526 = 1\ND20_Q2\UL2(F)
  UL3 12530       Q2  4\DW12530 = 1\ND20_Q2\UL3(F)
  IL1 12534       Q2  4\DW12534 = 1\ND20_Q2\IL1(F)
  IL2 12538       Q2  4\DW12538 = 1\ND20_Q2\IL2(F)
  IL3 12542       Q2  4\DW12542 = 1\ND20_Q2\IL3(F)
  PL1 12546       Q2  4\DW12546 = 1\ND20_Q2\PL1(F)
  PL2 12550       Q2  4\DW12550 = 1\ND20_Q2\PL2(F)
  PL3 12554       Q2  4\DW12554 = 1\ND20_Q2\PL3(F)
  QL1 12558       Q2  4\DW12558 = 1\ND20_Q2\QL1(F)
  QL2 12562       Q2  4\DW12562 = 1\ND20_Q2\QL2(F)
  QL3 12566       Q2  4\DW12566 = 1\ND20_Q2\QL3(F)
  S1  12570       Q2  4\DW12570 = 1\ND20_Q2\S1(F)
  S2  12574       Q2  4\DW12574 = 1\ND20_Q2\S2(F)
  S3  12578       Q2  4\DW12578 = 1\ND20_Q2\S3(F)
  </code></pre>