#coding:utf-8import snap7,time,json from snap7.util import * s7_clinet=snap7.client.Client() s7_clinet.connect("",0,1) class snap7_fuction(): def __init__(self,area,dbnumber,start,size,data=None): self.area=area self.dbnumber=dbnumber self.start=start self.size=size self.data=data def dataread(self): result = s7_clinet.read_area(area=self.area,dbnumber=self.dbnumber,start=self.start,size=self.size) return result def datawaite(self): result = s7_clinet.write_area(area=self.area,dbnumber=self.dbnumber,start=self.start,data=self.data) return result
根据实际内存地址及请求参数