Skip to content

Instantly share code, notes, and snippets.

@Bouni
Created November 5, 2014 11:56
Show Gist options
  • Save Bouni/598ff8b7cee0fc43e978 to your computer and use it in GitHub Desktop.
Save Bouni/598ff8b7cee0fc43e978 to your computer and use it in GitHub Desktop.
Modbus connection to SICK FlexiSoft
#!/usr/bin/env python
#---------------------------------------------------------------------------#
# import the various server implementations
#---------------------------------------------------------------------------#
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
from time import sleep
#---------------------------------------------------------------------------#
# configure the client logging
#---------------------------------------------------------------------------#
import logging
logging.basicConfig()
log = logging.getLogger()
log.setLevel(logging.DEBUG)
client = ModbusClient('192.168.1.51', port=9100)
client.connect()
rr = client.read_holding_registers(1100,25)
print(rr)
sleep(20)
#---------------------------------------------------------------------------#
# close the client
#---------------------------------------------------------------------------#
client.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment