Troubling with Read/Write into holding register in modbus rtu device

I am new to modbus rtu device. I could not read registers value ( error shown in picture ). I have tried so many times but could not get the values.

Screenshot from 2021-10-04 13-13-30.png

Also could not understand above error. Could anyone please explain what wrong with me.

Another problem is writing to register. Here is my write.py code.


Python:
from pymodbus.client.sync import ModbusSerialClient as ModbusClient
import logging
logging.basicConfig()
log = logging.getLogger()
log.setLevel(logging.DEBUG)

client = ModbusClient(method='rtu', port='COM3',bytesize=8,  stopbits=1,  parity='N', baudrate=9600, timeout=1)

client.connect()
print('Çonnected')
write=client.write_register(address=0x8000,value=0x13A, unit=0x11)
#read=client.read_holding_registers(address=0x8000,count=4, unit=0x11) 
if(write):
    print(write)

client.close()
But using sscom serial debug tool i am able to write holding registers successfully.

Manufacture company gives me limited documentation. I present some of them bellow.

Screenshot from 2021-10-04 23-44-20.png
Screenshot from 2021-10-04 23-46-49.png
If i want to read current value it shows me above error (picture 1)

I could not found it's solution by searching my errors.

Thanks in advance and I apologize for my English writing.
 
I think the problem is that what you've shown here from the manufacturer is not Modbus, even though that may be what the manufacturer claims. It is similar to Modbus, so maybe they tried to implement Modbus, but did it incorrectly.

For the "4) Set the target volume" request and response, here's the format from the Modbus spec for Function Code 06 Preset Single Register.
1633372945193.png

Furthermore, Function Code 06 can only write a single, 16-bit register, however the value above (0x0001E23A=123450) does not fit in a 16-bit integer. Maybe they meant to use Function Code 16 (10 Hex) Preset Multiple Register instead. But that's still not the correct format (they're missing the Byte Count field). Here is the format from the Modbus spec for Function Code 16 (for writing 2 registers).
1633373232323.png

The response for "8) Read the current value" also does not comply with the Modbus RTU specification, which is supposed to look like this (for reading 3 registers).
1633373450230.png
You cannot have an odd number for the Byte Count field, as Modbus registers are 16-bits (2 bytes) in length.

So if you want to communicate to this device, you can't use a Modbus library, because the protocol does not comply with the Modbus specification. You'll need to construct your own packets using this manufacturer's proprietary protocol.
 
Top