Looks like you have made a good start.
A few suggestions:
1. You may find that the address of the USB port on the Pi changes from time to time. This can cause some strange problems. You can set a persistent address for the port:
hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/
2. Instead of looping to get 8 values from the ventil array you can use "slice".
http://stackoverflow.com/questions/50921...e-notation
for example if you have 16 values in the array you can do:
first_8 = ventil[:9]
second_8 = ventil[9:]
3. you can send all 8 values at once using modbus function 16:
instrument.write_registers(0, first_8). Also, simpleMosbusSlave v10 supports function 6.
The MODBUS specification calls for using twisted pair cable like phone or network cable. I have been using non-twisted pair wire (sprinkler wire) without a problem with lengths of over 100 feet (30 M).
Dan
A few suggestions:
1. You may find that the address of the USB port on the Pi changes from time to time. This can cause some strange problems. You can set a persistent address for the port:
hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/
2. Instead of looping to get 8 values from the ventil array you can use "slice".
http://stackoverflow.com/questions/50921...e-notation
for example if you have 16 values in the array you can do:
first_8 = ventil[:9]
second_8 = ventil[9:]
3. you can send all 8 values at once using modbus function 16:
instrument.write_registers(0, first_8). Also, simpleMosbusSlave v10 supports function 6.
The MODBUS specification calls for using twisted pair cable like phone or network cable. I have been using non-twisted pair wire (sprinkler wire) without a problem with lengths of over 100 feet (30 M).
Dan