python西门子S7协议

简介: 以下是客户端函数使用,库为snap7,使用pip安装


#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

image.gif根据实际内存地址及请求参数

目录
相关文章
|
3月前
|
Web App开发 移动开发 JavaScript
Python网络编程(三),HTTP协议
Python网络编程(三),HTTP协议
60 0
|
3月前
|
缓存 网络协议 Python
Python网络编程(二)编写TCP协议程序
Python网络编程(二)编写TCP协议程序
118 0
|
29天前
|
网络协议 安全 网络安全
Python语言的互联网协议支持
Python语言的互联网协议支持
|
2月前
|
存储 Python
在Python中,如何实现对象的可哈希协议?
【2月更文挑战第2天】【2月更文挑战第4篇】在Python中,如何实现对象的可哈希协议?
|
2月前
|
索引 Python
在Python中,除了迭代器协议,还有哪些常用的对象协议?
在Python中,除了迭代器协议,还有哪些常用的对象协议?【2月更文挑战第2天】【2月更文挑战第3篇】
|
2月前
|
索引 Python
解释Python中的迭代器协议(Iterator Protocol)。
解释Python中的迭代器协议(Iterator Protocol)。【2月更文挑战第2天】【2月更文挑战第2篇】
|
3月前
|
网络协议 Python
Python网络编程(四),HTTP协议的python应用
Python网络编程(四),HTTP协议的python应用
35 0
|
3月前
|
网络协议 程序员 Linux
Python网络编程(一)TCP协议的引入
Python网络编程(一)TCP协议的引入
42 0
|
5月前
|
Web App开发 移动开发 网络协议
166 python网络编程 - HTTP协议简介
166 python网络编程 - HTTP协议简介
43 0

热门文章

最新文章