E850-DTU(4440-GPRS) datasheet
Copyright ©2012–2018
,成都亿佰特电子科技有限公司
23
4.4 Network function
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
the ASCII code length corresponding to the IP or domain name. The remaining registers are used to
store the ASCII code value corresponding to the IP or 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, it is also converted into
ASCII corresponding hexadecimal storage. (Note: The maximum length of the domain name does not
exceed 40 ASCII codes).
40101(0x0063)
40101(0x0064) -- 40121(0x0078)
Length
IP or domain name
00 0D
31 31 36 2E 36 32 2E 34 32 2E 31 39 32
Port 31687, corresponding to hexadecimal 7BC7; protocol type (TCP, UDP) is stored 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 with "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. Then
the unused registers must be filled with values in order to continuously write Modbus registers. The
corresponding register values are as follows:
40100(0x0063)
40101(0x0064) -- 40121(0x0078)
40122(0x0079)
40123(0x007A)
IP or domain
name length
IP or domain name value
Server port
TCP protocol
00 0D
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
7B C7
00 01
Since the length of the IP or domain name register is longer than the length of the IP or domain
name value, the length of the IP or domain name needs to be considered when writing the IP register,
that is, how many registers need to be occupied. For example, write the above IP into the modbus
register:
Modbus RTU protocol write Socket register: