哈尔滨九洲MC-Modbus-07367
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
HJZ-MC-Ⅳ型监控装置
HJZ-MC-IV Monitor Equipment
通讯规约(MC-Modbus-07367)Communication Conventions(MC-Modbus-07367)
哈尔滨九洲电气股份有限公司
HARBIN JIUZHOU ELECTRIC CO., LTD.
用户通讯规约
Communication Conventions For Consumer
一,Modbus规约说明
1. Modbus Instruction
在Modbus规约通讯过程中每个字节的格式为:1个开始位,8个数据位,2个停止位。
In the communication course abiding by the Modbus Conventions, each byte’s format is: 1 start-bit, 8 data-bits and 2 stop-bits.
数据的桢结构的格式为:地址域(8位),功能域(8位),数据域(n×8位),CRC校验(16位)。
The frame format of data: address field (8-bit), function field (8-bit), data field (n×8-bit), CRC parity (16-bit).
对于九洲公司的监控装置来说:地址域(即监控的地址)是可以通过监控装置设定的。功能域只识别功能编码03表示读一组寄存器;对于收到其他功能编码时,本监控发出例外情况响应。数据域包括多组数据,传送时,高位字节在前,低位字节在后。主机召唤从机的数据域包括从机寄存器的地址和数量,寄存器的地址是以0为参考的(例如查询地址为1的寄存器数值时,寄存器的地址为0);从机响应主机的数据域包括返回数据的字节计数和主机所要的数据。当本监控收到的数据地址是不允许时(即从机的寄存器地址是不允许的),将发出例外情况响应;当收到数据域的数值是不允许时(例如从机的寄存器的数量是不允许的),将发出例外情况响应。CRC域包括一个16位的二进制数,占两个字节,在传送时,低位字节在前,高位字
节在后。CRC校验码具体生成方式后面已给出C语言程序。
In the monitor equipments produced by Jiuzhou Co., address field (for monitor) can be set through itself. Its function field can only identify function code 03 which stands for reading a group of registers; when it receives other function-codes, the monitor equipment executes exception response. Data field contains groups of data, and low-bit byte goes after high-bit byte. The data field of main machine calling sub-machine contains address information and the number of sub-machine’s registers; the reference point of address is 0 (Namely, the register’s reference address would be 0 if its actual address is 1.); the data field of sub-machine’s response to main machine contains a byte count of returned data and the data demanded by main machine. When the monitor receives unavailable address (namely, the address of sub-machine’s register is unavailable.), the monitor equipment executes exception response; when it receives unavailable value of data field (namely, the number of sub-machine’s registers is unavailable.), the monitor equipment executes exception response. CRC field contains a binary unit, 16-bit and which is occupying 2 bytes. Low-bit byte goes before high-bit byte. The detailed generation of CRC parity code is given in the
following C language program.
1.读保持寄存器(功能码 03H)
1. Read Hold Register (Function Code 03H)
下图是主机查询和从机响应的一个例子。主机要查询6号从机的寄存器,寄存器地址为12至14,寄存器地址为12的内容为260(十六进制104),寄存器地址为13的内容为270(十六进制10E),寄存器地址为14的内容为15(十六进制0F)。请注意,信息中规定起始寄存器的地址为11(十六进制为B)。从机以功能编码响应,表明是一种正常的响应。字节计数表示将返回多少个8位数据项。作为遥测和遥信使用.
The following table is an example that main machine queries and sub-machine responds. Main machine inquires about registers of sub-machine 6#, and the registers’ addresses are 12~14: 12--- 260 (104 in hexadecimal); 13--- 270 (10E in hexadecimal); 14--- 15 (0F in hexadecimal). The beginning register’s reference address is 11 (B in hexadecimal) complying with our address rule. The normal response of sub-machine is to respond with function code. The count of bytes means how many 8-bit data items will be returned. And it is used to remotely detect and communicate.