I am looking for some advice on using the python (2.7) library "minimalmodbus" (version 0.7) to communicate with a Test Equity Modela 115a-F4T thermal chamber.
I am pretty new to using python to program hardware, so I am not quite sure if my approach is missing some basic initialization commands. Here is my code:
instrument = minimalmodbus.Instrument('/dev/ttyUSB1',1)
print instrument
print minimalmodbus.BAUDRATE
minimalmodbus.BAUDRATE = 9600
print minimalmodbus.BAUDRATE
print minimalmodbus.__version__
instrument.read_register(0,1)
Here is my output:
minimalmodbus.Instrument<id=0x7fb5fd2136c8, address=1, mode=rtu,
close_port_after_each_call=False, precalculate_read_size=True,
debug=False, serial=Serial<id=0x7fb5fc71a890, open=True>
(port='/dev/ttyUSB1', baudrate=19200, bytesize=8, parity='N',
stopbits=1, timeout=0.05, xonxoff=False, rtscts=False, dsrdtr=False)>
19200
9600
0.7
Traceback (most recent call last):
File "/usr/local/google/home/mimartin/Documents/test-equity/model-
115a.py", line 13, in <module>
instrument.read_register(0,1)
File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line
258, in read_register
return self._genericCommand(functioncode, registeraddress,
numberOfDecimals=numberOfDecimals, signed=signed)
File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line
697, in _genericCommand
payloadFromSlave = self._performCommand(functioncode, payloadToSlave)
File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line
795, in _performCommand
response = self._communicate(request, number_of_bytes_to_read)
File "/usr/local/lib/python2.7/dist-packages/minimalmodbus.py", line
930, in _communicate
raise IOError('No communication with the instrument (no answer)')
IOError: No communication with the instrument (no answer)*
The thermal chamber is powered on. And I am connected to it over a serial to USB cable. I have also placed a null modem adapter to the serial end (on the chamber) of the cable, as indicated is necessary in the Chamber Manual. I have assumed that my first line of code is what initializes the chamber for control. However, my error message indicates otherwise.
Looking for some help or guidance here. Thank you.