Modbus协议学习第一篇之基础概念

Modbus
专栏收录该内容
¥19.90
¥99.00
7 篇文章

什么是“协议”

        大白话解释:协议是用来正确传递消息数据而设立的一种规则。传递消息的双方(两台计算机)在通信时遵循同一种协议,即可理解彼此传递的消息数据。

Modbus协议模型

        Modbus协议模型较为简单,使用一种称为应用数据单元ADU(Application Data Unit)的模型,而应用数据单元模型ADU又由地址域+PDU+校验域组成。

        地址域:设备的地址标识。

        PDU:协议数据单元(Modbus协议模型的核心),由功能码+数据组成。

        校验域:用于检查传输的数据是否准确(数据在链路中传输有可能会失真,如0变1,1变0,接收端可通过校验域来检查是否有失真的情况)

        具体协议模型如图所示:

Modbus协议运行机制

        Modbus协议的通信双方一般被称之为主机设备(客户端)和从机设备(服务端,提供数

VIP Modbus介绍与协议解析 modbus是什么 modbus介绍 modbus功能码 开通可读全文·4.1k 阅读·0 点赞·7 收藏 阅读全文

相关推荐

modbus-tcp协议学习-python

1. 前言 modbus_tk是使用python语言实现的modbus协议栈,该库函数及支持主机也支持从机,同时支持RTU串口通信和TCP范式通信。 2. 准备工作 查阅modbus相关资料 下载modbus-tcp tester,这里面有server-tester和client-tester,能加速测试程序过程 3. modbus_tk安装 环境:python2.7, win10 & 树莓派 操

小鸟达子的博客 1万+

MODBUS协议学习的一点心得

最近刚写完一个完整的MODBUS协议(RTU),包括主站和从站。 其实主站从站这个说法不全面,应该是请求方(request)和回应方(respond)。协议的说明书是从回应方的角度来写的,而请求方因为需求不一样,写法有很多。 协议没有讲的一个地方是DATBUF,数据存储区。作为从站必须要有这样的4个区来保存数据。一个区:线圈输入;一个区:线圈输出。一个区:寄存器输入;一个区:寄...

laocui1的博客 2975

Modbus协议学习方法

在刚开始接触modbus协议的时候,很容易被里面的各种功能码搞晕,同时在编写程序的时候也容易搞不清楚每一位数据代表的含义。如果在学习的过程中有实际的发送和接收数据的例子话,那么理解modbus协议就会更容易一些。下面我将自己借助软件学习的方法分享给大家

HXYDJ的博客 1933

Modbus协议学习分享

本文举例致远PA300系列功率计,Modbus协议学习分享。 1.功率计终端仪器Modbus协议设置流程图 操作:按面板上“接口“按键”->Modbus->on 2.支持协议 支持以太网TCP/IP通信方式和串行链路RTU通信方式,其中以太网通信端口号502。 3.使用限制 使用以太网连接时,最大支持4个连接。串口连接时,最大支持1个连接。其中Modbus设备地址范围1~247。 4.使用建议 使用RS232接口实现的Modbus协议,必要时需要进行端口的电平转换,同时为了保证数据传输

weixin_45692672的博客 2374

Modbus协议学习第四篇之线圈的概念

第一次在Modbus接触线圈的概念,应该是在介绍功能码的时候,因为其中有一个功能码是“读线圈状态”。我们可以把“线圈状态”理解为一种寄存器,类似于计算机中的寄存器概念,所以读线圈状态就是读某个寄存器,而这个特殊的寄存器其实就是一个bit,也就是要么是on/1,要么是off/0。把线圈状态理解成只能存一个bit信息的寄存器,就会很好理解线圈这个概念了。(免责声明:本博文仅供参考,因为博主也是初学者)

hzf978742221的博客 4632

Modbus协议最基础概念详细介绍

一文认识Modbus协议

一名热爱技术的工程师的博客。分享技术干货,记录美好生活。永远相信美好的事情即将发生。 9984

详解modbus通讯协议

详解modbus通讯协议。可作为编程开发的参考。

雷达信号处理——恒虚警检测(CFAR)

上图展示的是同时在距离维和多普勒维进行恒虚警检测的原理,如果只是在距离维或多普勒维做CFAR,检测单元的左右两侧均有设定好数量的保护单元和参考单元。不同的CFAR检测器适用于不同的场景,CA-CFAR算法适用于均匀环境中的单目标或彼此相距较远的多目标环境,在邻近多目标环境会发生目标的遮蔽效应,在杂波边缘会发生杂波边缘效应。从图中也可以看到,根据阈值的选择不同,有不同的检测器,其中CA-CFAR是取的参考单元的均值,SO-CFAR取的是参考单元的最小值,而GO-CFAR是取的参考单元的最大值。

诚朴勇毅 3万+

mysql9.0windows安装

将这里的位置修改为你刚刚创建并复制data目录的地址即可,win11的系统使用vscode修改之后,会让你确认开启更高权限以进行保存,比较方便,window10不需要确认,修改后可以直接保存。:在修改之前,最好将下图文件进行备份,将原始的文件保存好一份,以防更改了配置之后,导致mysql服务报错,无法启动,备份好的话直接将有问题的配置文件给替换就可以,无需重新安装一次mySql。双击下载的msi文件进行安装。安装有问题的,可以直接进行卸载,新本的mySql会将注册表中的数据自动进行清除,还是很方便的。

m0_74824123的博客 6441

游戏脚本开发避坑:Python调用OP模块实现阴阳师后台操作的5个关键点

本文深入探讨了使用Python调用OP模块开发《阴阳师》后台自动化脚本的5个核心避坑点。重点解析了窗口绑定、后台截图与图像识别、鼠标键盘模拟、脚本稳定性以及性能优化等关键环节的常见问题与实战解决方案,帮助开发者高效实现稳定的游戏后台挂机功能。

u0v1w2x3的博客 582

【软件系统架构】系列十一:面向对象技术—sysML

摘要: SysML(系统建模语言)是UML的扩展,专为复杂系统工程设计,支持硬件、软件、人员等跨领域建模。其核心包括9种图:4种结构图(如块定义图BDD、内部块图IBD)、4种行为图(如活动图AD、序列图SD)和需求图(REQ),覆盖需求、结构、行为及参数约束。相比UML(面向软件),SysML精简图表(9 vs 13),强化需求追踪与性能分析(如参数图PD),并支持MBSE(基于模型的系统工程)。需求关系(如满足、验证、派生)在需求图中明确关联设计实现,形成闭环管理。SysML是UML的子集与系统工程扩展

moton2017的博客 1894

YOLOv11损失函数原理与源码解读:从调参血泪史到源码级优化

本文深入解析YOLOv11目标检测模型的损失函数设计,揭示其相比前代的关键改进。重点剖析了回归损失中动态权重的小目标优化、分类损失的带温度系数softmax、以及目标损失的自适应阈值机制等创新点。作者通过源码分析指出常见实现陷阱,如梯度回传的正确处理方式、标签分配的匹配策略等。结合实战经验,给出针对小目标检测、类别误判等典型问题的调参建议,并分享实用的调试工具代码片段。最后强调损失函数调参需结合具体任务,指出后处理对实际部署效果的重要影响。全文以工程实践为导向,为开发者提供可直接落地的优化思路。

as1225120794的博客 434

数学建模学习(121):Python实现模糊AHP(Fuzzy AHP)——从原理到实践

Python实现模糊AHP(Fuzzy AHP)

全栈川川 1533

在 SAP S/4HANA 分析模型中添加 Measures,Calculated、Restricted、Currency Conversion 与 Unit Conversion 的建模思路

摘要: SAP S/4HANA分析查询建模中,度量(measure)的加工层级是关键难点,涉及聚合时机、币种/单位语义、过滤上下文等复杂因素。度量不仅是数字字段,还需处理计算口径(Calculated Measures)、上下文绑定(Restricted Measures)和单位转换等问题。Calculated Measures适合派生指标(如毛利率),需注意聚合前后计算差异;Restricted Measures通过固化过滤条件(如区分实际/计划金额)确保业务语义一致性。建模时应将业务逻辑下沉到分析模型层

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 1017

RAP 通用搜索实战:用 CDS 注解打造 Fiori Elements 的一体化检索体验

RAP应用中的通用搜索优化实践:通过CDS注解实现高效模糊匹配 摘要:本文介绍了在SAP RAP应用中优化列表搜索体验的方法。通过CDS注解配置通用搜索功能,用户无需指定字段即可在多字段中模糊匹配数据。关键实现包括:1)使用@Search.searchable启用全局搜索;2)通过@Search.defaultSearchElement标记核心搜索字段;3)利用@Search.fuzzinessThreshold设置容错阈值(0.7-1.0)处理拼写错误;4)使用@Search.ranking优化结果排序。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 1388

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: .vue文件中,引入子组件提示报错:File ‘xxx.vue.ts‘ is not a module的解决方案
下一篇: Modbus协议学习第二篇之Modbus poll & slave仿真软件初体验

双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —
CodemanNotColdman
博客等级 码龄10年 4578粉丝 25原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

CodemanNotColdman

谢谢您给予我创作下去的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值