diff --git a/pymodbus/payload.py b/pymodbus/payload.py index 63a54aa05..d4e289754 100644 --- a/pymodbus/payload.py +++ b/pymodbus/payload.py @@ -199,7 +199,7 @@ def fromRegisters(klass, registers, endian=Endian.Little): :returns: An initialized PayloadDecoder ''' if isinstance(registers, list): # repack into flat binary - payload = ''.join(pack('>H', x) for x in registers) + payload = ''.join(pack(endian + 'H', x) for x in registers) return klass(payload, endian) raise ParameterException('Invalid collection of registers supplied')