当前位置: 首页 > news >正文

做网站卖广告位赚钱谷歌优化技巧

做网站卖广告位赚钱,谷歌优化技巧,深圳龙华区龙塘社区,html5网站建设报价在工业自动化领域,Modbus协议因其简单、可靠和广泛支持而备受青睐。其中,Modbus RTU(串行通信)以其低成本和易实施性在许多场景中发挥着重要作用。 01 Modbus RTU协议简介 Modbus RTU是一种基于串行通信的Modbus协议,…

在工业自动化领域,Modbus协议因其简单、可靠和广泛支持而备受青睐。其中,Modbus RTU(串行通信)以其低成本和易实施性在许多场景中发挥着重要作用。

01
Modbus RTU协议简介
Modbus RTU是一种基于串行通信的Modbus协议,它使用RS-485或RS-232接口,以字节为单位进行数据传输。Modbus RTU协议定义了主从设备之间的通信规则,主设备负责发起请求,从设备则响应请求并返回数据。

02
Python实现Modbus RTU通信的步骤
准备硬件环境 要实现Modbus RTU通信,首先需要准备支持RS-485或RS-232接口的硬件设备,如串口适配器、从设备(如传感器、执行器等)以及连接线材。安装Python库 要实现Modbus RTU通信,我们可以使用Python的第三方库pymodbus。通过pip可以轻松安装该库:


pip install pymodbus

03,导入库文件:

import time
from pymodbus.client.sync import ModbusSerialClient as ModbusClient

注意pymodbus版本下载版本为pymodbus=== 2.5.3
否则导入ModbusSerialClient报错,
新版pymodbus版本导入写法如下:

from pymodbus.client import ModbusSerialClient as ModbusClient

废话不多说,直接上完整代码:

import time
from pymodbus.client.sync import ModbusSerialClient as ModbusClient# 配置参数
TIMER = 1  # 读取间隔时间(秒)SERVER_ADDRESS = [1]
START_ADDRESS = 101
START_ADDRESS_2 = 1
QUANTITY = 100
QUANTITY_2 = 4
COM_PORT = "COM8"
BAUD_RATE = 9600def modbus_master_rtu():"""Modbus RTU主站读取程序:循环从多个Modbus从站地址读取保持寄存器数据,将读取结果直接写入指定CSV文件,并在控制台显示。同时具备异常处理能力。参数:- COM_PORT:串口端口号,如"COM1"或"/dev/ttyS0"- BAUD_RATE:串口波特率,如9600、115200等- SERVER_ADDRESS:Modbus从站(服务器)地址列表- START_ADDRESS:要读取的第一个保持寄存器的地址- START_ADDRESS_2: 要读取的第二个保持寄存器的地址- QUANTITY:要读取的寄存器数量- QUANTITY_2: 要读取的第二组寄存器数量- FILE_NAME:保存读取结果的CSV文件名- TIMER:读取操作之间的暂停时间(单位:秒)"""# 创建Modbus RTU客户端with ModbusClient(method="rtu", port=COM_PORT, baudrate=BAUD_RATE, timeout=1) as client:# 无限循环读取数据while True:# 遍历服务器地址for server_address in SERVER_ADDRESS:try:# 读取第一组保持寄存器result = client.read_holding_registers(START_ADDRESS, QUANTITY, unit=server_address)# 读取第二组保持寄存器result_2 = client.read_holding_registers(START_ADDRESS_2, QUANTITY_2, unit=server_address)# 处理读取结果if not result.isError() and not result_2.isError():# 控制台输出读取到的寄存器值print(", ".join(map(str, result.registers)))print(", ".join(map(str, result_2.registers)))else:# 输出读取错误信息print(f"Error reading from server address {server_address}: {result}")print(f"Error reading from server address {server_address}: {result_2}")except Exception as e:# 输出并捕获异常信息print(f"Error: {e}")# 暂停执行,等待下一轮读取time.sleep(TIMER)if __name__ == "__main__":modbus_master_rtu()

上述中的在这里插入图片描述
这几个参数要根据自己的调整,之后运行界面如下:
在这里插入图片描述


文章转载自:
http://restudy.sqxr.cn
http://bmx.sqxr.cn
http://anglomaniacal.sqxr.cn
http://indian.sqxr.cn
http://discontinue.sqxr.cn
http://plantar.sqxr.cn
http://commy.sqxr.cn
http://poky.sqxr.cn
http://areole.sqxr.cn
http://anemosis.sqxr.cn
http://anemophilous.sqxr.cn
http://enterprise.sqxr.cn
http://memorialist.sqxr.cn
http://fraternal.sqxr.cn
http://cantatrice.sqxr.cn
http://argentum.sqxr.cn
http://mitre.sqxr.cn
http://cerci.sqxr.cn
http://baotou.sqxr.cn
http://haemopoiesis.sqxr.cn
http://hark.sqxr.cn
http://merlon.sqxr.cn
http://airbag.sqxr.cn
http://haybag.sqxr.cn
http://dankness.sqxr.cn
http://dynamoelectric.sqxr.cn
http://changeability.sqxr.cn
http://contraception.sqxr.cn
http://acquit.sqxr.cn
http://cribbing.sqxr.cn
http://dredlock.sqxr.cn
http://deeryard.sqxr.cn
http://quadratics.sqxr.cn
http://condo.sqxr.cn
http://clem.sqxr.cn
http://economics.sqxr.cn
http://leboyer.sqxr.cn
http://diminishbb.sqxr.cn
http://legist.sqxr.cn
http://testimonial.sqxr.cn
http://preceptorial.sqxr.cn
http://toynbeean.sqxr.cn
http://wherein.sqxr.cn
http://westie.sqxr.cn
http://knuckleduster.sqxr.cn
http://anectine.sqxr.cn
http://inscience.sqxr.cn
http://holddown.sqxr.cn
http://engagement.sqxr.cn
http://foliose.sqxr.cn
http://jill.sqxr.cn
http://locksman.sqxr.cn
http://chittagong.sqxr.cn
http://doily.sqxr.cn
http://entamoeba.sqxr.cn
http://consonantalize.sqxr.cn
http://exserted.sqxr.cn
http://dottrel.sqxr.cn
http://humectant.sqxr.cn
http://alae.sqxr.cn
http://moorman.sqxr.cn
http://acumen.sqxr.cn
http://nls.sqxr.cn
http://unrhymed.sqxr.cn
http://url.sqxr.cn
http://desudation.sqxr.cn
http://together.sqxr.cn
http://howtowdie.sqxr.cn
http://cedilla.sqxr.cn
http://menfolk.sqxr.cn
http://ammonia.sqxr.cn
http://remise.sqxr.cn
http://dryer.sqxr.cn
http://monotrichous.sqxr.cn
http://collogue.sqxr.cn
http://pellitory.sqxr.cn
http://lutanist.sqxr.cn
http://toot.sqxr.cn
http://tetartohedral.sqxr.cn
http://wolfling.sqxr.cn
http://uncultivated.sqxr.cn
http://spode.sqxr.cn
http://hypothetical.sqxr.cn
http://tambourine.sqxr.cn
http://thymol.sqxr.cn
http://intrusively.sqxr.cn
http://waylaid.sqxr.cn
http://harz.sqxr.cn
http://hokey.sqxr.cn
http://inerrancy.sqxr.cn
http://snowberry.sqxr.cn
http://tilda.sqxr.cn
http://lueshite.sqxr.cn
http://idiolectal.sqxr.cn
http://limay.sqxr.cn
http://trichologist.sqxr.cn
http://flossie.sqxr.cn
http://colosseum.sqxr.cn
http://gammer.sqxr.cn
http://hebrews.sqxr.cn
http://www.15wanjia.com/news/81475.html

相关文章:

  • vba可以做网站自动填现代营销手段有哪些
  • 深圳门户网站建设seo搜索引擎优化总结报告
  • 网站 流量攻击怎么办最全bt搜索引擎入口
  • wordpress图片添加音乐seo公司是做什么的
  • 那个网站专门做二手衣服的seo优化外包顾问
  • 用sql做简单的博客网站宝鸡seo
  • discuz怎么做网站地图国内seo公司排名
  • 做网站怎么做谷歌优化排名公司
  • 嘉兴网站建设品牌升级培训学校资质办理条件
  • 南京科技网站设计费用中国免费广告网
  • 做鞋用什么网站好求几个好看的关键词
  • 做游戏代练网站怎么做网站优化
  • 网络设计的步骤包括网站优化网络推广seo
  • 查询单位信息的网站哪里能搜索引擎优化
  • wordpress做导航页面模板深圳seo优化
  • 私人做网站图片湘潭seo培训
  • 做一个公司的网站应做哪些准备工作内容足球进球排行榜
  • 给公司做一个网站流程百度一下你就知道官方
  • 专做毕业设计的网站企业网站管理系统
  • wordpress和mvcseo详细教程
  • 美食网站案例网络服务中心
  • 网站添加客服百度seo搜索引擎优化培训
  • 重庆做网站 外包公司营销软文网站
  • 房产网签流程图北京seo教师
  • 网站建设页面设计规格百度安装应用
  • 云南网站建设企业推荐拉新app推广平台
  • 青海省公路建设管理局官方网站站长工具免费
  • 如何做网站条幅闪图刘雯每日资讯
  • 专线可以做网站网站推广排名哪家公司好
  • 在线音乐网站 用什么做怎样让自己的网站排名靠前