Wiki source code of LX5V-ETH-BD

Last modified by Wecon on 2025/09/03 21:02

Show last authors
1 = **1 Features** =
2
3 1. LX5V-ETH-BD is an Ethernet module installed on the top of PLC.
4 1. Only Modbus TCP protocol is supported currently.
5 1. One LX5V-ETH-BD board supports up to 8 devices (regardless of master and slave).
6
7 (% class="box infomessage" %)
8 (((
9 **✎Note:** This manual is only applicable to the use of LX5V-ETH-BD with 5V series PLC. For specific instructions on the use of LX5V-ETH-BD with 3V series PLC, please refer to LX3VP-ETH-BD Board Manual.
10 )))
11
12 = **2 Appearance and indicator light** =
13
14 (% style="text-align:center" %)
15 [[image:image-20220913161056-17.png||class="img-thumbnail"]]
16
17 |=(% scope="row" style="width: 130px;" %)**Indicator light**|=(% style="width: 94px;" %)**Color**|=(% style="width: 852px;" %)**Description**
18 |=(% style="width: 130px;" %)PWR|(% style="width:94px" %)White|(% style="width:852px" %)Power light: It is always ON when the power supply connection is normal.
19 |=(% style="width: 130px;" %)COM|(% style="width:94px" %)White|(% style="width:852px" %)The communication light between BD board and PLC. How fast it flashes is determined by the number of PLC communication. After Plugging in the network cable, configuring Ethernet parameters by the host computer software, and downloading, the communication light flashes.
20 |=(% style="width: 130px;" %)DATA|(% style="width:94px" %)Yellow|(% style="width:852px" %)Network access light. It is ON when accessing the network. If the contact is not good, the indicator light is OFF or flashing (the same as the lights of general network cards).
21 |=(% style="width: 130px;" %)LINK|(% style="width:94px" %)Green|(% style="width:852px" %)Network communication Light. It flashes when network communication is normal (the same as the light of general network card).
22
23 = **3 Parameter configuration** =
24
25 The Ethernet parameters of LX5V-ETH-BD are configured by the host computer, dividing into basic parameter configuration and link parameter configuration.
26
27 == Basic parameter configuration ==
28
29 * Open the host computer and create a new project,double-click "BD Board Configuration" in “Project Manager” → “Extended Function”**^^Note^^**^^ ^^to enter “BD Settings” Interface;
30 * Select "LX5V-ETH" in the device bar on the right side of the BD board configuration interface and double-click to add it to the corresponding slot position of PLC (slot 1 or 2, the software will select slot 1 by default. You could right-click it to move to slot 2);
31 * After adding BD board to the slot, double-click or right-click to select configuration parameters to enter the LX5V-ETH-BD configuration parameters interface, as shown in the following figure. IP address, subnet mask, and default gateway of LX5V-ETH-BD could be configured in this interface. Currently, only static IP could be configured.
32
33 (% style="text-align:center" %)
34 [[image:image-20220913160540-1.jpeg||class="img-thumbnail"]]
35
36 (% class="box infomessage" %)
37 (((
38 **✎Note: **This function is only supported by the following host computer and slave computer versions:
39 )))
40
41 Supported host computer versions: Wecon PLC Editor 2 2.1.204 and above, shown as below.
42
43 (% style="text-align:center" %)
44 [[image:image-20220913160540-2.jpeg||class="img-thumbnail"]]
45
46 Supported slave computer versions: 2.061 and above, shown as below.
47
48 [[image:image-20220913160540-3.jpeg]]
49
50 == Link configuration ==
51
52 (% style="text-align:center" %)
53 [[image:image-20220913160540-4.jpeg]]
54
55 (% class="box infomessage" %)
56 (((
57 **✎Note:** One LX5V-ETH-BD supports up to 8 Ethernet links, each of which can be individually configured to enable.
58 )))
59
60 **Description of each configuration item for each link:**
61
62 * **Whether to enable:** Indicates whether the configuration is valid. When it is False, the configured socket ID cannot be used.
63 * **Socket ID: **This field is assigned by the host computer and cannot be modified.
64 * **Communication protocol:** Currently only the Modbus TCP protocol is supported.
65 * **Operating mode:** Client and server can be selected.
66 * **Local port:**
67 ** When the client is selected as the operating mode, the local port cannot be configured and is assigned by the BD board. The assigned port number range is 4096to32767.
68 ** When the server is selected as the operating mode, the local port is fixed as 502, and only Modbus TCP protocol is supported.
69 * **Destination IP:** It is valid when the client is selected as the operating mode, indicating that the client needs to connect to the server address.
70 * **Destination port:** It is valid when the client is selected as the operating mode, indicating that the client needs to connect to the server port.
71 * **Receive timeout:** It is valid when the client is selected as the operating mode, indicating the maximum waiting time from the instruction sent to the response. When the receive timeout is exceeded, but the response has not yet returned, the receive timeout error will be reported.
72 * **TCP keep-alive:** It is valid for both client and server. After enable, it will monitor whether the link has data interaction. If the link does not send or receive data for more than 50 seconds, it means that the other party of the connection may fail, and the link is closed immediately to recycle the link resources.
73 * **Link data information initial device (R) and link status information initial device (S):** It is valid when the server is selected as the operating mode. During the initialization process of the ladder diagram, using these devices, the SOCOPEN/create socket link operation is automatically performed, and you do not need to perform the SOCOPEN operation in the ladder diagram.
74
75 = **4 Instructions used** =
76
77 == SOCOPEN/Create socket link ==
78
79 Create a socket link specified by (S), update the data information of the socket link to (D1), and update the status information to (D2).
80
81 -[SOCOPEN (S) (D1) (D2)]
82
83 **Content, range and data type**
84
85 |=(% scope="row" %)**Parameter**|=(% style="width: 499px;" %)**Content**|=(% style="width: 98px;" %)**Range**|=(% style="width: 177px;" %)**Data type**|=(% style="width: 187px;" %)**Data type (label)**
86 |=(S)|(% style="width:499px" %)Socket ID|(% style="width:98px" %)-|(% style="width:177px" %)Signed BIN16 bits|(% style="width:187px" %)ANY16
87 |=(D1)|(% style="width:499px" %)The data information initial device that stores socket links.|(% style="width:98px" %)-|(% style="width:177px" %)Signed BIN16 bits|(% style="width:187px" %)ANY_ELEMENTARY
88 |=(D2)|(% style="width:499px" %)The status information initial device that stores socket links.|(% style="width:98px" %)-|(% style="width:177px" %)Bit|(% style="width:187px" %)ANY_BOOL
89
90 (% class="box infomessage" %)
91 (((
92 **✎Note: **The socket ID is configured by Ethernet host computer, and cannot be selected at will.
93 )))
94
95 **Device used**
96
97 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="13" %)**Devices**|(((
98 **Offset**
99
100 **modification**
101 )))|(((
102 **Pulse**
103
104 **extension**
105 )))
106 |**X**|**Y**|**M**|**S**|**SM**|**D.b**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
107 |(% rowspan="3" %)SOCOPEN|Parameter 1| | | | | | | | | | | |●|●| |
108 |Parameter 2| | | | | | |●|●|●|●|●| | | |
109 |Parameter 3| |●|●|●|●|●| | | | | | | | |
110
111 **Function**
112
113 Create a link to the socket specified in (S) and display the link information in (D1) and (D2).
114
115 When the instruction is turned on, the device specified in (D1) and (D2) will be used in other Ethernet instructions using the same socket ID (e.g. SOCCLOSE, SOCMTCP).
116
117 The information specified by (D1) is as follows. (A total of 14 word devices are occupied):
118
119 |=(% scope="row" style="width: 303px;" %)**Devices**|=(% style="width: 772px;" %)**Function**
120 |=(% style="width: 303px;" %)(D1)|(% style="width:772px" %)Local port number
121 |=(% style="width: 303px;" %)(D1+1)|(% style="width:772px" %)The 1st segment of destination IP
122 |=(% style="width: 303px;" %)(D1+2)|(% style="width:772px" %)The 2nd segment of destination IP
123 |=(% style="width: 303px;" %)(D1+3)|(% style="width:772px" %)The 3rd segment of destination IP
124 |=(% style="width: 303px;" %)(D1+4)|(% style="width:772px" %)The 4th segment of destination IP
125 |=(% style="width: 303px;" %)(D1+5)|(% style="width:772px" %)The 5th segment of destination IP
126 |=(% style="width: 303px;" %)(D1+6)|(% style="width:772px" %)Receive timeout (10ms)
127 |=(% style="width: 303px;" %)(D1+7)|(% style="width:772px" %)Reserved
128 |=(% style="width: 303px;" %)(D1+8)|(% style="width:772px" %)Current link error code
129 |=(% style="width: 303px;" %)(D1+9)|(% style="width:772px" %)Communication error count high word
130 |=(% style="width: 303px;" %)(D1+10)|(% style="width:772px" %)Communication error count low word
131 |=(% style="width: 303px;" %)(D1+11)|(% style="width:772px" %)Reserved
132 |=(% style="width: 303px;" %)(D1+12)|(% style="width:772px" %)Reserved
133 |=(% style="width: 303px;" %)(D1+13)|(% style="width:772px" %)Reserved
134
135 **Parameter description:**
136
137 * Local port number:
138 ** Establish a TCP client, and PLC automatically assigns the local communication port. The range is 4096to32767. The port number will be automatically increased by 1 each time it is turned ON.
139 ** Establish a TCP server specified by the Ethernet socket configuration of the host computer.
140 * Destination IP:
141 ** Establish a TCP client, and the destination address is specified by the Ethernet socket configuration of the host computer.
142 ** Establish a TCP server and display the IP of the remote connection after the remote client connection is successful.
143 * Destination port number:
144 ** Establish a TCP client, and the destination port number is specified by the Ethernet socket configuration of the host computer.
145 ** Establish a TCP server and display the port number of the remote connection after the remote client connection is successful.
146 * Receive timeout (10ms): Specified by Ethernet socket configuration of host computer.
147 * Current link error code: Displays the current error information. For specific errors, please refer to the Ethernet error list.
148 * Number of communication errors: the total number of communication errors after successful connection (double words).
149
150 The information specified by (D2) is as follows. (A total of 14 bit devices are occupied):
151
152 |=(% scope="row" style="width: 187px;" %)**Devices**|=(% style="width: 387px;" %)**ON status**|=(% style="width: 502px;" %)**OFF status**
153 |=(% style="width: 187px;" %)(D2)|(% style="width:387px" %)Connecting|(% style="width:502px" %)Connection not enabled
154 |=(% style="width: 187px;" %)(D2+1)|(% style="width:387px" %)Connection complete|(% style="width:502px" %)Connecting or not connected
155 |=(% style="width: 187px;" %)(D2+2)|(% style="width:387px" %)Reserved|(% style="width:502px" %)Reserved
156 |=(% style="width: 187px;" %)(D2+3)|(% style="width:387px" %)Reserved|(% style="width:502px" %)Reserved
157 |=(% style="width: 187px;" %)(D2+4)|(% style="width:387px" %)Reserved|(% style="width:502px" %)Reserved
158 |=(% style="width: 187px;" %)(D2+5)|(% style="width:387px" %)Reserved|(% style="width:502px" %)Reserved
159 |=(% style="width: 187px;" %)(D2+6)|(% style="width:387px" %)Connection closed|(% style="width:502px" %)Instruction not started or closed completed
160 |=(% style="width: 187px;" %)(D2+7)|(% style="width:387px" %)Connection close complete|(% style="width:502px" %)Instruction not started or closing
161 |=(% style="width: 187px;" %)(D2+8)|(% style="width:387px" %)(((
162 Communication completion
163
164 (for SOCMTCP instruction)
165 )))|(% style="width:502px" %)In communication
166 |=(% style="width: 187px;" %)(D2+9)|(% style="width:387px" %)Connection error|(% style="width:502px" %)No connection error
167 |=(% style="width: 187px;" %)(D1+10)|(% style="width:387px" %)Reserved|(% style="width:502px" %)Reserved
168 |=(% style="width: 187px;" %)(D1+11)|(% style="width:387px" %)Reserved|(% style="width:502px" %)Reserved
169 |=(% style="width: 187px;" %)(D1+12)|(% style="width:387px" %)Reserved|(% style="width:502px" %)Reserved
170 |=(% style="width: 187px;" %)(D1+13)|(% style="width:387px" %)Reserved|(% style="width:502px" %)Reserved
171
172 **Error code**
173
174 |=(% scope="row" style="width: 189px;" %)**Error code**|=(% style="width: 886px;" %)**Content**
175 |=(% style="width: 189px;" %)4085H|(% style="width:886px" %)The devices specified in the application instructions (D1) and (D2) exceed the range of the corresponding device.
176 |=(% style="width: 189px;" %)5080H|(% style="width:886px" %)The Ethernet socket has been linked and cannot be opened repeatedly.
177 |=(% style="width: 189px;" %)5083H|(% style="width:886px" %)Failed to create TCP server.
178 |=(% style="width: 189px;" %)5084H|(% style="width:886px" %)Failed to create link
179 |=(% style="width: 189px;" %)5086H|(% style="width:886px" %)The socket ID used by the Ethernet instruction is not configured or enabled by the host computer.
180
181 == SOCMTCP/Ethernet Modbus TCP Communication ==
182
183 Ethernet Modbus TCP client communication instruction.
184
185 -[SOCMTCP (S1) (S2) (S3) (S4) (S5)]
186
187 **Content, range and data type**
188
189 |=(% scope="row" %)**Parameter**|=(% style="width: 481px;" %)**Content**|=(% style="width: 127px;" %)**Range**|=(% style="width: 186px;" %)**Data type**|=(% style="width: 182px;" %)**Data type (label)**
190 |=(S1)|(% style="width:481px" %)Socket ID|(% style="width:127px" %)-|(% style="width:186px" %)Signed BIN16 bits|(% style="width:182px" %)ANY16
191 |=(S2)|(% style="width:481px" %)The high byte is the station number and the low byte is the function code|(% style="width:127px" %)-|(% style="width:186px" %)Signed BIN16 bits|(% style="width:182px" %)ANY_ELEMENTARY
192 |=(S3)|(% style="width:481px" %)Modbus address that requires communication|(% style="width:127px" %)0 to 65535|(% style="width:186px" %)Unsigned BIN16 bits|(% style="width:182px" %)ANY16
193 |=(S4)|(% style="width:481px" %)Send or receive length|(% style="width:127px" %)-|(% style="width:186px" %)Signed BIN16 bits|(% style="width:182px" %)ANY16
194 |=(S5)|(% style="width:481px" %)Send or receive initiation device|(% style="width:127px" %)-|(% style="width:186px" %)Signed BIN16 bits|(% style="width:182px" %)ANY_ELEMENTARY
195
196 (% class="box infomessage" %)
197 (((
198 **✎Note**: The socket ID is configured by Ethernet host computer, and cannot be selected at will.
199 )))
200
201 **Device used**
202
203 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="7" %)**Devices**|(((
204 **Offset**
205
206 **modification**
207 )))|(((
208 **Pulse**
209
210 **extension**
211 )))
212 |**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
213 |(% rowspan="5" %)SOCMTCP|Parameter 1| | | | | |●|●| |
214 |Parameter 2|●|●|●|●|●|●|●| |
215 |Parameter 3|●|●|●|●|●|●|●| |
216 |Parameter 4|●|●|●|●|●|●|●| |
217 |Parameter 5|●|●|●|●|●| | | |
218
219 **Function**
220
221 * (S1): Specify the socket ID of the link, and other parameters are compatible with the RS instruction Modbus master protocol.
222 * (S2): The high byte is the station number. For Modbus TCP, the station number can be set at will.
223 * (S2): The lower byte is the station number. Please refer to the Modbus function code section of RS instruction.
224 * (S3): Modbus communication address, the address of the Modbus TCP server to be read or written.
225
226 It must be used with the SOCOPEN instruction, and data can only be sent after a complete link is established.
227
228 This instruction can only be used when a TCP client socket link is established.
229
230 Communication completion information and the number of received and sent can be viewed in the device specified by SOCOPEN instruction.
231
232 **Error code**
233
234 |=(% scope="row" style="width: 165px;" %)**Error code**|=(% style="width: 910px;" %)**Content**
235 |=(% style="width: 165px;" %)5081H|(% style="width:910px" %)The Ethernet socket is not open and cannot be operated.
236 |=(% style="width: 165px;" %)5086H|(% style="width:910px" %)The socket ID (S1) used by the Ethernet instruction is not configured on the host computer or is not enabled after configuration.
237
238 == SOCCLOSE/Close socket link ==
239
240 Close the socket link specified by (S).
241
242 -[SOCCLOSE (S)]
243
244 **Content, range and data type**
245
246 |=(% scope="row" style="width: 182px;" %)**Parameter**|=(% style="width: 181px;" %)**Content**|=**Range**|=**Data type**|=**Data type (label)**
247 |=(% style="width: 182px;" %)(S)|(% style="width:181px" %)socket ID|-|Signed BIN16 bits|ANY16
248
249 (% class="box infomessage" %)
250 (((
251 **✎Note:** The socket ID is configured by Ethernet host computer, and cannot be selected at will.
252 )))
253
254 **Device used**
255
256 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="2" %)**Devices**|(((
257 **Offset**
258
259 **modification**
260 )))|(((
261 **Pulse**
262
263 **extension**
264 )))
265 |**K**|**H**|**[D]**|**XXP**
266 |SOCCLOSE|Parameter 1|●|●| |
267
268 **Function**
269
270 Close the socket link specified in (S).
271
272 When the TCP server is shut down, it will send a reset request to the remote client. At this time, in the bit device specified by SOCOPEN, the status of connection closing will be set. Only when the state of connection closing is set can the socket be truly released and the next link be opened.
273
274 If the socket specified by (S) is not connected to the remote party, it cannot be closed, and the instruction reports an error.
275
276 **Error code**
277
278 |=(% scope="row" style="width: 184px;" %)**Error code**|=(% style="width: 891px;" %)**Content**
279 |=(% style="width: 184px;" %)5081H|(% style="width:891px" %)The Ethernet socket is not open and cannot be operated.
280 |=(% style="width: 184px;" %)5086H|(% style="width:891px" %)The socket ID used by the Ethernet instruction is not configured or enabled by the host computer.
281
282 = **5 Description of PLC special devices** =
283
284 [[image:image-20220913160540-5.jpeg]]
285
286 **BD1:**
287
288 |=(% scope="row" style="width: 178px;" %)**SD label**|=(% style="width: 897px;" %)**Content**
289 |=(% style="width: 178px;" %)SD2000|(% style="width:897px" %)Display 0x1020 after Ethernet BD is recognized after power-on.
290 |=(% style="width: 178px;" %)SD2001|(% style="width:897px" %)Display Ethernet BD version after Ethernet BD is recognized after power-on.
291 |=(% style="width: 178px;" %)SD 2005|(% style="width:897px" %)BD1 error communication port.
292 |=(% style="width: 178px;" %)SD2006|(% style="width:897px" %)BD1 communication timeout (1ms).
293 |=(% style="width: 178px;" %)SD2009|(% style="width:897px" %)Ethernet BD1 keep-alive time settings.
294
295 **BD2:**
296
297 |=(% scope="row" style="width: 175px;" %)**SD label**|=(% style="width: 900px;" %)**Content**
298 |=(% style="width: 175px;" %)SD2020|(% style="width:900px" %)Display 0x1020 after Ethernet BD is recognized after power-on.
299 |=(% style="width: 175px;" %)SD2021|(% style="width:900px" %)Display Ethernet BD version after Ethernet BD is recognized after power-on.
300 |=(% style="width: 175px;" %)SD2025|(% style="width:900px" %)BD2 error communication port.
301 |=(% style="width: 175px;" %)SD2026|(% style="width:900px" %)BD2 communication timeout (1ms).
302 |=(% style="width: 175px;" %)SD2029|(% style="width:900px" %)Ethernet BD2 keep-alive time settings.
303
304 = **6 Address mapping** =
305
306 When the BD board configures the Modbus TCP slave protocol, the address mapping relationship accessed by the master station is as follows:
307
308 |=(% colspan="5" %)**Word address**
309 |(% style="width:216px" %)**Address type**|(% style="width:171px" %)**Occupation**|(% style="width:225px" %)**Address range**|(% style="width:196px" %)**Decimal address**|(% style="width:268px" %)**Total reserved address size**
310 |(% style="width:216px" %)T0 to T511|(% style="width:171px" %)512 WORD|(% style="width:225px" %)0x0000 to 0x01ff|(% style="width:196px" %)0|(% style="width:268px" %)1536
311 |(% style="width:216px" %)C0 to C255|(% style="width:171px" %)256 WORD|(% style="width:225px" %)0x0600 to 0x06ff|(% style="width:196px" %)1536|(% style="width:268px" %)1024
312 |(% style="width:216px" %)LC0 to LC255|(% style="width:171px" %)512 WORD|(% style="width:225px" %)0x0A000 to 0x0BFF|(% style="width:196px" %)2560|(% style="width:268px" %)1024
313 |(% style="width:216px" %)HSC0 to HSC15|(% style="width:171px" %)128 word|(% style="width:225px" %)0x0E00 to 0x0E1F|(% style="width:196px" %)3584|(% style="width:268px" %)512
314 |(% style="width:216px" %)D0 to D7999|(% style="width:171px" %)8000 WORD|(% style="width:225px" %)0x1000 to 0x2F3F|(% style="width:196px" %)4096|(% style="width:268px" %)16384
315 |(% style="width:216px" %)SD0 to SD4095|(% style="width:171px" %)4096 WORD|(% style="width:225px" %)0x5000 to 0x5FFF|(% style="width:196px" %)20480|(% style="width:268px" %)12288
316 |(% style="width:216px" %)R0 to R30000|(% style="width:171px" %)30000 WORD|(% style="width:225px" %)0x8000 to 0xF52F|(% style="width:196px" %)32768|(% style="width:268px" %)30000
317
318 |=(% colspan="5" %)**Bit address**
319 |(% style="width:212px" %)**Address type**|(% style="width:171px" %)**Occupation**|(% style="width:224px" %)**Address range**|(% style="width:198px" %)**Decimal address**|(% style="width:271px" %)**Total reserved address size**
320 |(% style="width:212px" %)T0 to T511|(% style="width:171px" %)512 bits|(% style="width:224px" %)0x0000 to 0x01ff|(% style="width:198px" %)0|(% style="width:271px" %)1536
321 |(% style="width:212px" %)C0 to C255|(% style="width:171px" %)256 bits|(% style="width:224px" %)0x0600 to 0x06ff|(% style="width:198px" %)1536|(% style="width:271px" %)1024
322 |(% style="width:212px" %)LC0 to LC255|(% style="width:171px" %)256 bits|(% style="width:224px" %)0x0A00 to 0x0AFF|(% style="width:198px" %)2560|(% style="width:271px" %)1024
323 |(% style="width:212px" %)HSC0 to HSC15|(% style="width:171px" %)64 bits|(% style="width:224px" %)0x0E00 to 0x0E0F|(% style="width:198px" %)3584|(% style="width:271px" %)512
324 |(% style="width:212px" %)M0 to M8000|(% style="width:171px" %)8192 bits|(% style="width:224px" %)0x1000 to 0x2F3F|(% style="width:198px" %)4096|(% style="width:271px" %)16384
325 |(% style="width:212px" %)SM0 to SM4095|(% style="width:171px" %)4096 bits|(% style="width:224px" %)0x5000 to 0x5FFF|(% style="width:198px" %)20480|(% style="width:271px" %)12288
326 |(% style="width:212px" %)Reserved|(% style="width:171px" %) |(% style="width:224px" %)0x8000 to 0xBFFF|(% style="width:198px" %) |(% style="width:271px" %)16383
327 |(% style="width:212px" %)S0 to S4095|(% style="width:171px" %)4096 bits|(% style="width:224px" %)0xC000 to 0xCFFF|(% style="width:198px" %)49152|(% style="width:271px" %)8192
328 |(% style="width:212px" %)X0 to X1023|(% style="width:171px" %)1024 bits|(% style="width:224px" %)0xE000 to 0xE3FF|(% style="width:198px" %)57344|(% style="width:271px" %)4096
329 |(% style="width:212px" %)Y0 to Y1023|(% style="width:171px" %)1024 bits|(% style="width:224px" %)0xF000 to 0xF3FF|(% style="width:198px" %)61440|(% style="width:271px" %)4096
330
331 When using the Modbus TCP master station to access the slave station, the SOCMTCP instruction specifies the following address:
332
333 **Example 1: Read 10 registers starting from slave station (station NO.1) D0 and store them in 10 devices starting from local D0:**
334
335 (% style="text-align:center" %)
336 [[image:image-20220913160540-6.png||class="img-thumbnail"]]
337
338 The function code of this instruction is 3, which indicates reading register, and the address H1000 in it is the starting address of "D0 to D7999" by inquiring the "word address table", which corresponds to the address of D0.
339
340 **Example 2: Read 10 bit devices starting from slave station (station NO.1) M0 and store them in local D0 device (because D0 can store the value of 16 bit devices, zero padding will be performed):**
341
342 (% style="text-align:center" %)
343 [[image:image-20220913160540-7.png||class="img-thumbnail"]]
344
345 The function code of the instruction is 1, which indicates read coil, and the address H1000 in it is the starting address of “M0 to M8000" by inquiring the "bit address table", which corresponds to the address of M0. If slave stations M0 and M1 are 1, and the rest are 0, the value in D0 is H0300 (not H0003).
346
347 = **7 Examples** =
348
349 == Example 1 ==
350
351 **Configure 8 Modbus TCP slave protocols**. The basic parameters are configured as follows:
352
353 (% style="text-align:center" %)
354 [[image:image-20220913160540-8.jpeg||class="img-thumbnail"]]
355
356 (% class="box infomessage" %)
357 (((
358 **✎Note:** The IP address should be configured in the same network segment as the IP address of the master station. For example, if the IP address of the master station is 192.168.8.8 and the subnet mask is 255.255.255.0, the IP address of the BD board should be configured as 192.168.8.xx (the value of xx is 1to255. Do not duplicate other IP addresses on the same network segment).
359 )))
360
361 **The parameters of link 1 to 4 are configured as follows:**
362
363 (% style="text-align:center" %)
364 [[image:image-20220913160540-9.jpeg]]
365
366 (% class="box infomessage" %)
367 (((
368 **✎Note**: The server needs to configure "link data information initial device" and "link status information initial device", and the settings of each link should not overlap.
369 )))
370
371 **The parameters of link 5 to 8 are configured as follows:**
372
373 (% style="text-align:center" %)
374 [[image:image-20220913160540-10.jpeg]]
375
376 After the configuration is completed, there is no need to configure ladder diagram, and it will take effect after downloading programs and parameters.
377
378 == **Example 2** ==
379
380 Configure a Modbus TCP master protocol to read 125 word devices from the address 0 of slave. Whether the communication is correct is judged by comparing whether the first word device is 100, and count the success and failure.
381
382 **The basic parameters are configured as follows:**
383
384 (% style="text-align:center" %)
385 [[image:image-20220913160540-11.jpeg]]
386
387 **The parameters of link 1 to 4 are configured as follows:**
388
389 Because only one client is configured, none of the links except the first one are enabled.
390
391 (% style="text-align:center" %)
392 [[image:image-20220913160540-12.jpeg]]
393
394 **The parameters of link 5 to 8 are configured as follows:**
395
396 (% style="text-align:center" %)
397 [[image:image-20220913160540-13.jpeg]]
398
399 **The configuration ladder diagram is as follows:**
400
401 (% style="text-align:center" %)
402 [[image:image-20220913160540-14.jpeg||class="img-thumbnail"]]
403
404 (% style="text-align:center" %)
405 [[image:image-20220913160540-15.jpeg||class="img-thumbnail"]]
406
407 (% style="text-align:center" %)
408 [[image:image-20220913160540-16.jpeg||class="img-thumbnail"]]