tht
tht

Reputation: 1

Minimalmodbus Illegal Address

I am new to the modbus and I am trying minimalmodbus library for python. I have a device connected and trying the examples provided by the minimalmobus documentation I get the following error:

MinimalModbus debug mode. Create serial port COM13
MinimalModbus debug mode. Will write to instrument (expecting 7 bytes back): 01 03 00 04 00 01 C5 CB (8 bytes)
MinimalModbus debug mode. Clearing serial buffers for port COM13
MinimalModbus debug mode. No sleep required before write. Time since previous read: 7361796.00 ms, minimum silent period: 1.75 ms.
MinimalModbus debug mode. Closing port COM13
MinimalModbus debug mode. Response from instrument: 01 83 02 C0 F1 (5 bytes), roundtrip time: 30.0 ms. Timeout for reading: 0.0 ms.

Traceback (most recent call last):
  File "k.py", line 15, in <module>
    r=instrument.read_register(4,1,functioncode=3)
  File "C:\Users\Themistoklis\AppData\Local\Programs\Python\Python36-32\lib\site-packages\minimalmodbus.py", line 486, in read_register
    payloadformat=_Payloadformat.REGISTER,
  File "C:\Users\Themistoklis\AppData\Local\Programs\Python\Python36-32\lib\site-packages\minimalmodbus.py", line 1245, in _generic_command
    payload_from_slave = self._perform_command(functioncode, payload_to_slave)
  File "C:\Users\Themistoklis\AppData\Local\Programs\Python\Python36-32\lib\site-packages\minimalmodbus.py", line 1330, in _perform_command
    response, self.address, self.mode, functioncode
  File "C:\Users\Themistoklis\AppData\Local\Programs\Python\Python36-32\lib\site-packages\minimalmodbus.py", line 1880, in _extract_payload
    _check_response_slaveerrorcode(response)
  File "C:\Users\Themistoklis\AppData\Local\Programs\Python\Python36-32\lib\site-packages\minimalmodbus.py", line 3538, in _check_response_slaveerrorcode
    raise error
minimalmodbus.IllegalRequestError: Slave reported illegal data address

My code is a simple one which follows the examples provided

import minimalmodbus
import serial

instrument = minimalmodbus.Instrument('COM13',1,debug=True)

instrument.serial.baudrate=115200
instrument.serial.parity=serial.PARITY_EVEN

print(instrument.read_register(4,1,functioncode=3))

instrument.serial.close()

I know that the register number 4 is a good one since when I use a Labview example provided with the device I get a reading from that. I would appreciate it if anyone can provide me with some more in depth info about the errors of minimalmodbus and what do they exactly mean.

Upvotes: 0

Views: 1447

Answers (0)

Related Questions