18
4.按照标准规约,如果额定电流、功率不够显
示时,读取到的通信值将被缩小 1000 倍。
4. According to the standard specification, if the
rated current or power is not enough to
display, the read communication value will be
reduced by 1000 times.
7.3 Modbus 协议 Modbus protocol
当数据帧到达终端设备时,它通过一个简单
的“端口”进入被寻址到的设备,该设备去掉数据
帧的“信封”(数据头),读取数据,如果没有错误,
就执行数据所请求的任务,然后,它将自己生成的
数据加入到取得的“信封”中,把数据帧返回给发
送者。返回的响应数据中包含了以下内容:终端从
机地址
(Address)
、被执行了的命令
(Function)
、执行
命令生成的被请求数据
(Data)
和一个
CRC
校验码
(Check)。发生任何错误都不会有成功的响应,或者
返回一个错误指示帧。
When the data frame arrives at the terminal
device, it enters the addressed device through a simple
"port", the device removes the "envelope"(data header)
of the data frame, reads the data, and if there is no
error, executes the task requested by the data, then it
will add its own data to the obtained "envelope" and
return the data frame to the sender. The returned
response data includes the following contents: the
terminal slave address(Address), the executed
command(Function), the requested data generated by
executing command(Data), and a check code(Check).
There will be no successful response to any error, or
an error indication frame is returned.
7.3.1
数据帧
Data frame format
7.3.2
地址
(Address)
域
Address domain
地址域在帧首,由一个字节(
8-Bits
,
8
位二进
制码)组成,十进制为
0
~
255
,在我们的系统中只
使用 1~247,其它地址保留。这些位标明了用户指
定的终端设备的地址,该设备将接收来自与之相连
的主机数据。同一总线上每个终端设备的地址必须
是唯一的,只有被寻址到的终端才会响应包含了该
地址的查询。当终端发送回一个响应,响应中的从
机地址数据便告诉了主机哪台终端正与之进行通
信。
The address domain is at the beginning of the
frame and consists of one byte (8-bits, 8-bit binary
code). The decimal value is 0 to 255. Only 1 to 247
are used in our system, and other addresses are
reserved. These bits indicate the address of the
user-specified terminal device that will receive data
from the host to which it is connected. The address of
each terminal device must be unique. Only the
terminal to which it is addressed will respond to a
query containing the address. When the terminal sends
back a response, the data of the slave address in the
response tells the host which terminal is
communicating with it.
7.3.3
功能
(Function)
域
Function domain
功能域代码告诉了被寻址到的终端执行何种
功能。下表列出了该系列仪表用到的功能码,以及
它们的意义和功能。
The function field code tells the functions of the
addressed terminal. The following table lists the
function codes used by this series of instruments, as
well as their meanings and functions.
读取保持寄存器
Read holding
register
在一个或多个保持寄存器中取得当前的二进制值
Get the current binary value in one or more holding
registers