Hi…
How to communicate Siemens PLC through Modbus Tcp/ip in Python.
And how to Read & Write value(data) from PLC.
HI did you get it to work? If so can you please email me your python code to tashriqpandy@gmail.com
You can try to use LECPython module, I think this is a great choice for you.
from LECPython import LECPython
from time import sleep
lecp = LECPython()
res = lecp.SiemensS7NetConnection("S200", "192.168.0.2", 102, 0x02, 0x03, "CDAB", True, 2000)
if res["IsSuccess"]:
plc = res["Content"]
print("Connection success")
else:
print("Connection error")
# Read memory flag M1
r = lecp.ReadNodeValues(plc, "V1104.0", "bool", 1)
print("M1: ", r["Content"])
# Read output V1064.0
r = lecp.ReadNodeValues(plc, "V1064.0", "bool", 1)
print("Q1:", r["Content"])
This is the document address of LECPython LECPython | docfx