Chengdu Ebyte Electronic Technology Co.,Ltd E851-RTU(4440-ETH) User Manual
Copyright ©2012–2019, Chengdu Ebyte Electronic Technology Co.,Ltd
4.4 Network related functions
4.4.1. Server IP or domain name, port, TCP or UDP settings (Socket)
The server IP or domain name is stored by 22 modbus registers. The first register is used to store IP or the length of
the ASCII code corresponding to the domain name, the remaining registers are used to store IP or the ASCII code value
corresponding to the domain name. For example, the IP is 116.62.42.192, the port is 31687, a total of 13 characters, that
is, the length is 0x000D, and the IP corresponding ASCII code value is 31 31 36 2E 36 32 2E 34 32 2E 31 39 32. The
corresponding modbus register storage value is as follows table. If it is a domain name, the corresponding domain name
is also converted into ASCII corresponding hexadecimal storage. (Note: The maximum length of the domain name does
not exceed 40 ASCII codes)
40101(0x0064) -- 40121(0x0078)
31 31 36 2E 36 32 2E 34 32 2E 31 39 32
Port 31687, corresponding to hexadecimal 7BC7; The protocol type (TCP, UDP) is saved using the protocol register, the
value 0x0001 corresponds to the TCP protocol, and the value 0x0000 corresponds to the UDP protocol. That is, when the
IP is 116.62.42.192 and the port is 31687, the TCP protocol, the unused IP or domain name register can be filled as "0" or
not filled. If you need to use the function code “0x10” to write the IP, domain name, port, and protocol type at one time,
the unused registers must be filled with values to continuously write the modbus register. The corresponding register
values are as follows:
40101(0x0064) -- 40121(0x0078)
31 31 36 2E 36 32 2E 34 32 2E 31 39 32 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00
Because the length of IP or domain name register is longer than that of IP or domain name value, it is necessary to consider the length
of IP or domain name when writing IP register, that is, how many registers need to be occupied. If the above IP is written to the
Modbus register: