BigTuna
Member
I posted this over on the pymodbus google group but just in case someone has experience with this I'll try here as well...
Maybe someone can help me figure out what I'm missing here. I'm following the example exactly:
Using MacModbus App (http://www.modbusapps.com/) I can see the binary in the memory locations:
42654 0111011111101010
42655 0100001000000111
Putting the 2 registers together (01000010000001110111011111101010) and checking here:
http://www.h-schmidt.net/FloatConverter/IEEE754.html
I get my 33.87.
Since I've confirmed everything is there in memory does anyone see what I'm doing wrong with my pymodbus code?
Thanks!
Maybe someone can help me figure out what I'm missing here. I'm following the example exactly:
#!/usr/bin/env python
'''
Pymodbus Payload Building/Decoding Example
--------------------------------------------------------------------------
'''
from pymodbus.constants import Endian
from pymodbus.payload import BinaryPayloadDecoder
from pymodbus.payload import BinaryPayloadBuilder
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
client = ModbusClient('192.168.0.10)
client.connect()
rr = client.read_holding_registers(2654, 2)
decoder = BinaryPayloadDecoder.fromRegisters(rr.registers, endian=Endian.Little)
print decoder.decode_32bit_float()
client.close()
What I'm suppose to get is 33.87. What it prints is 1.46638408846e-34'''
Pymodbus Payload Building/Decoding Example
--------------------------------------------------------------------------
'''
from pymodbus.constants import Endian
from pymodbus.payload import BinaryPayloadDecoder
from pymodbus.payload import BinaryPayloadBuilder
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
client = ModbusClient('192.168.0.10)
client.connect()
rr = client.read_holding_registers(2654, 2)
decoder = BinaryPayloadDecoder.fromRegisters(rr.registers, endian=Endian.Little)
print decoder.decode_32bit_float()
client.close()
Using MacModbus App (http://www.modbusapps.com/) I can see the binary in the memory locations:
42654 0111011111101010
42655 0100001000000111
Putting the 2 registers together (01000010000001110111011111101010) and checking here:
http://www.h-schmidt.net/FloatConverter/IEEE754.html
I get my 33.87.
Since I've confirmed everything is there in memory does anyone see what I'm doing wrong with my pymodbus code?
Thanks!
Last edited: