i am using minimalmodbus to read register 1010 function 3 i am getting the error '\x01\x83\x01\x80ð'. i can see the data in "MODSCAN" software for the register. please help me understand the error message. it would be great if you can provide a solution. the communication is being done through RS232 8-N-2
import minimalmodbus import serial import time print(minimalmodbus._getDiagnosticString()) minimalmodbus.BAUDRATE=9600 minimalmodbus.PARITY='N' minimalmodbus.BYTESIZE=8 minimalmodbus.STOPBITS=2 minimalmodbus.TIMEOUT=1 minimalmodbus.CLOSE_PORT_AFTER_EACH_CALL = False instrument = minimalmodbus.Instrument('COM1', 1) #port and slave print(instrument) while True: batterVolt = instrument.read_register(registeraddress=1011, numberOfDecimals=0, functioncode=3, signed=False) print(batterVolt) time.sleep(1)output--
Output:C:\Users\shraman\PycharmProjects\vfdtry\venv\Scripts\python.exe C:/Users/shraman/PycharmProjects/vfdtry/venv/vfdtry.py
## Diagnostic output from minimalmodbus ##
Minimalmodbus version: 0.7
Minimalmodbus status: Beta
File name (with relative path): C:\Users\shraman\PycharmProjects\vfdtry\venv\lib\site-packages\minimalmodbus.py
Full file path: C:\Users\shraman\PycharmProjects\vfdtry\venv\lib\site-packages\minimalmodbus.py
pySerial version: 3.4
pySerial full file path: C:\Users\shraman\PycharmProjects\vfdtry\venv\lib\site-packages\serial\__init__.py
Platform: win32
Filesystem encoding: 'utf-8'
Byteorder: little
Python version: 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)]
Python version info: sys.version_info(major=3, minor=7, micro=3, releaselevel='final', serial=0)
Python flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0, dev_mode=False, utf8_mode=0)
Python argv: ['C:/Users/shraman/PycharmProjects/vfdtry/venv/vfdtry.py']
Python prefix: 'C:\\Users\\shraman\\PycharmProjects\\vfdtry\\venv'
Python exec prefix: 'C:\\Users\\shraman\\PycharmProjects\\vfdtry\\venv'
Python executable: 'C:\\Users\\shraman\\PycharmProjects\\vfdtry\\venv\\Scripts\\python.exe'
Long info: (none)
Float repr style: 'short'
Variable __name__: minimalmodbus
Current directory: C:\Users\shraman\PycharmProjects\vfdtry\venv
Python path:
C:\Users\shraman\PycharmProjects\vfdtry\venv
C:\Users\shraman\PycharmProjects\vfdtry
C:\Users\shraman\AppData\Local\Programs\Python\Python37-32\python37.zip
C:\Users\shraman\AppData\Local\Programs\Python\Python37-32\DLLs
C:\Users\shraman\AppData\Local\Programs\Python\Python37-32\lib
C:\Users\shraman\AppData\Local\Programs\Python\Python37-32
C:\Users\shraman\PycharmProjects\vfdtry\venv
C:\Users\shraman\PycharmProjects\vfdtry\venv\lib\site-packages
C:\Users\shraman\PycharmProjects\vfdtry\venv\lib\site-packages\setuptools-40.8.0-py3.7.egg
C:\Users\shraman\PycharmProjects\vfdtry\venv\lib\site-packages\pip-19.0.3-py3.7.egg
Error:minimalmodbus.Instrument<id=0x877f30, address=1, mode=rtu, close_port_after_each_call=False, precalculate_read_size=True, debug=False, serial=Serial<id=0x877ef0, open=True>(port='COM1', baudrate=9600, bytesize=8, parity='N', stopbits=2, timeout=1, xonxoff=False, rtscts=False, dsrdtr=False)>
Traceback (most recent call last):
File "C:/Users/shraman/PycharmProjects/vfdtry/venv/vfdtry.py", line 29, in <module>
batterVolt = instrument.read_register(registeraddress=0x3F2, numberOfDecimals=0, functioncode=3, signed=False)
File "C:\Users\shraman\PycharmProjects\vfdtry\venv\lib\site-packages\minimalmodbus.py", line 258, in read_register
return self._genericCommand(functioncode, registeraddress, numberOfDecimals=numberOfDecimals, signed=signed)
File "C:\Users\shraman\PycharmProjects\vfdtry\venv\lib\site-packages\minimalmodbus.py", line 697, in _genericCommand
payloadFromSlave = self._performCommand(functioncode, payloadToSlave)
File "C:\Users\shraman\PycharmProjects\vfdtry\venv\lib\site-packages\minimalmodbus.py", line 798, in _performCommand
payloadFromSlave = _extractPayload(response, self.address, self.mode, functioncode)
File "C:\Users\shraman\PycharmProjects\vfdtry\venv\lib\site-packages\minimalmodbus.py", line 1088, in _extractPayload
raise ValueError('The slave is indicating an error. The response is: {!r}'.format(response))
ValueError: The slave is indicating an error. The response is: '\x01\x83\x01\x80ð'
Process finished with exit code 1