Python与PLC通过Modbus通信
先安装modbus_tk包import modbus_tk.modbus_tcp as mtimport modbus_tk.defines as md# 远程连接到服务器端master = mt.TcpMaster("192.168.1.2", 502)master.set_timeout(5.0)value = master.execute(slave=1, function_code=md.WRITE_SINGLE_REGISTER, starting_address=