ModBus通信协议.ppt
《ModBus通信协议.ppt》由会员分享,可在线阅读,更多相关《ModBus通信协议.ppt(23页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、1 1ModBusModBus通信协议及通信调试通信协议及通信调试2 2目目 录录 一一 Modbus协议协议 三三 Modbus数据包的分析数据包的分析 四四 简单简单Linux操作命令操作命令 九九 常见问题分析讲解常见问题分析讲解3Modbus协议协议Modbus 协议是应用于电子控制器上的一种通用语言。它已经成为一通用工业标准。有了它,不同厂商生产的控制设备可以连成工业网络,进行集中监控ModBus通信采用主从方式,在同一个网络中有一个主设备及最多达255台从设备,从设备的地址编码为1255。通常情况下,主设备只与1台从设备通信,但当主设备发出的地址码为0即采用广播方式时,可以将消息发
2、送给所有的从设备ModBus一次通信其发送和接收的数据包由若干帧组成,协议正是定义了这些帧的意义,控制器只要按照协议解释其接收和发送的帧数据,就能与在同一网络中采用同样协议的控制器实现通信4Modbus协议协议ModBus协议有两种通信模式:ASC II模式和RTU(远程终端单元)模式。ASC II模式是将一个字节分为两个ASC II字符发送,而RTU模式以十六进制传送数据,一个字节就是一帧,因而数据传送的效率高于ASCII模式,大多数工业控制器采用RTU模式。目前我们接触过的采用ASC II模式的设备只有SHAFER的气液联动阀的电子控制单元。在同一个网络中,无论主机还是从机,都必须采用相同
3、的通信模式及相同的传输速率。如:9600,N,8,15Modbus协议协议ModBus协议有两种通信模式:ASC II模式和RTU(远程终端单元)模式。ASC II模式是将一个字节分为两个ASC II字符发送,而RTU模式以十六进制传送数据,一个字节就是一帧,因而数据传送的效率高于ASCII模式,大多数工业控制器采用RTU模式。目前我们接触过的采用ASC II模式的设备只有SHAFER的气液联动阀的电子控制单元。在同一个网络中,无论主机还是从机,都必须采用相同的通信模式及相同的传输速率。如:9600,N,8,16Modbus协议协议-询问询问应答应答7Modbus协议协议-询问询问应答应答Th
4、e Query:The function code in the query tells the addressed slave device what kind of action to perform.The data bytes contain any additional information that the slave will need to perform the function.For example,function code 03 will query the slave to read holding registers and respond with their
5、 contents.The data field must contain the information telling the slave which register to start at and how many registers to read.The error check field provides a method for the slave to validate the integrity of the message contents.8Modbus协议协议-询问询问应答应答The Response:If the slave makes a normal respo
6、nse,the function code in the response is an echo of the function code in the query.The data bytes contain the data collected by the slave,such as register values or status.If an error occurs,the function code is modified to indicate that the response is an error response,and the data bytes contain a
7、 code that describes the error.The error check field allows the master to confirm that the message contents are valid.9 9目目 录录 一一 Modbus协议协议 三三 Modbus数据包的分析数据包的分析 四四 简单简单Linux操作命令操作命令 九九 常见问题分析讲解常见问题分析讲解10Modbus数据包的分析数据包的分析-功能码功能码03QUERY RESPONSE Slave Address:01 Slave Address:01 Function:03 Functio
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- ModBus 通信协议
限制150内