Created
November 5, 2014 11:56
-
-
Save Bouni/598ff8b7cee0fc43e978 to your computer and use it in GitHub Desktop.
Modbus connection to SICK FlexiSoft
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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