I have a usb-to-rs485 cable connected to an ubuntu pc controlling a motor controller.
When I connect the usb to the PC I get port 'ttyACM0' and everything works well.
But when I close the program, regardless of running instrument.serial.close() or not, the second time around running the same program I get this:
File "drive_motor_lib.py", line 30, in write_register
self.instrument.write_register(register, value, functioncode=6)
File "/home/orin/.local/lib/python3.8/site-packages/minimalmodbus.py", line 552, in write_register
self._generic_command(
File "/home/orin/.local/lib/python3.8/site-packages/minimalmodbus.py", line 1276, in _generic_command
payload_from_slave = self._perform_command(functioncode, payload_to_slave)
File "/home/orin/.local/lib/python3.8/site-packages/minimalmodbus.py", line 1353, in _perform_command
response_bytes = self._communicate(request_bytes, number_of_bytes_to_read)
File "/home/orin/.local/lib/python3.8/site-packages/minimalmodbus.py", line 1521, in _communicate
raise NoResponseError("No communication with the instrument (no answer)")
minimalmodbus.NoResponseError: No communication with the instrument (no answer)
I have a usb-to-rs485 cable connected to an ubuntu pc controlling a motor controller.
When I connect the usb to the PC I get port 'ttyACM0' and everything works well.
But when I close the program, regardless of running
instrument.serial.close()
or not, the second time around running the same program I get this:Any thoughts on how I can proceed with this?