Skip to content

read_input_registers is limited 16 bit? #93

Open
@mofm

Description

@mofm

Description

The documentation of my Modbus device is as follows:

"Signed Measurement (32-bit)
Decade Exponent (Signed 8-bit)
Binary Signed value (24 bit)
Example: - 123456*10-3 = FDFE 1DC0(16)"

But as it is written in the documentation of the umodbus.serial library:
"Input registers can hold values ​​between 0 and 65535. If supported by the client device, data can be marked as signed values ​​to represent -32768 through 32767."

So this function only supports 16 bit values? Also, if positive values ​​do not exceed 65000, there is no problem. But negative values ​​are returned, such as 65xxx. How can I fix this?

Reproduction steps

...

MicroPython version

v1.23.0

MicroPython board

Raspberry Pico

MicroPython Modbus version

# e.g. v2.3.3
# use the following command to get the used version
import os
from umodbus import version
print('MicroPython infos:', os.uname())
print('Used micropthon-modbus version:', version.__version__))

Relevant log output

No response

User code

No response

Additional informations

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions