Closed as not planned
Description
Dear pymodbus team,
with version 3.6.6 it was possible to decode 8 bit values.
But with version 3.9.2 this is no possible anymore, because the DATATYPE.UINT8
and DATATYPE.INT8
are missing.
Could you provide also these datatypes for backward compatiliby?
I used the following function:
def decode_register_readings(self, readings, datatype, count) -> list:
"""Decode the register readings
Decode readings depending on datatype given
-----
Args:
readings: dats read from register
datatype: U16, U32 , etc...
count: number of datatypes to be converted
Returns:
data: list of decoded values
"""
decoder = BinaryPayloadDecoder.fromRegisters(readings.registers, \
byteorder=Endian.BIG, wordorder=Endian.BIG)
#print(f'decoder : {decoder}')
data = []
if datatype == 'U8':
data = [decoder.decode_8bit_uint() for i in range(count)]
elif datatype == 'U16':
data = [decoder.decode_16bit_uint() for i in range(count)]
elif datatype == 'U32':
data = [decoder.decode_32bit_uint() for i in range(count)]
elif datatype == 'U64':
data = [decoder.decode_64bit_uint() for i in range(count)]
elif datatype == 'S8':
data = [decoder.decode_8bit_int() for i in range(count)]
elif datatype == 'S16':
data = [decoder.decode_16bit_int() for i in range(count)]
elif datatype == 'S32':
data = [decoder.decode_32bit_int() for i in range(count)]
elif datatype == 'S64':
data = [decoder.decode_64bit_int() for i in range(count)]
return data
Metadata
Metadata
Assignees
Labels
No labels