Wiki source code of LCM-16EX
Version 3.1 by Jim(Forgotten) on 2023/01/07 10:36
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | = **1 Naming rule** = | ||
2 | |||
3 | Naming rule of LCM I/O input expansion module: | ||
4 | |||
5 | (% style="text-align:center" %) | ||
6 | [[image:LCM-16EX User manual_html_ebe98bcd646c1f95.png||height="73" width="200" class="img-thumbnail"]] | ||
7 | |||
8 | 1. WECON PLC series; | ||
9 | 1. Input points No. | ||
10 | 1. Product type, E means expansion; | ||
11 | 1. Expansion input(X); | ||
12 | |||
13 | = **2 Dimensions** = | ||
14 | |||
15 | (% style="text-align:center" %) | ||
16 | [[image:LCM-16EX User manual_html_68c5a29b5500b36c.png||height="331" width="800" class="img-thumbnail"]] | ||
17 | |||
18 | 1. Input indicator for each channel | ||
19 | 1. LINK: RS485 communication state | ||
20 | 1. 485 communication terminal | ||
21 | 1. Module power DC24V | ||
22 | 1. Extension module name | ||
23 | 1. Analog signal input terminal | ||
24 | 1. DIN rail mounting slot | ||
25 | 1. DIN rail hook | ||
26 | 1. Mounting holes (φ4.5) | ||
27 | |||
28 | (% style="text-align:center" %) | ||
29 | [[image:LCM-16EX User manual_html_af08a5d98d9f129d.png||height="468" width="700" class="img-thumbnail"]] | ||
30 | |||
31 | (% border="1" class="table-bordered" %) | ||
32 | |**Name**|**Description**|**Led states**|**Event state** | ||
33 | |(% rowspan="3" %)LINK|(% rowspan="3" %)RS485 communication states|Led Blink|Normal communication | ||
34 | |Led OFF|Communication exception, stop, or failure | ||
35 | |Led ON|Abnormal software operation or hardware failure | ||
36 | |||
37 | == **2.1 Crimp terminations** == | ||
38 | |||
39 | ((( | ||
40 | * Please use crimp terminals as indicated on the graph. | ||
41 | * The tightening torque should be applied 5 to 8 Kg.cm. | ||
42 | * Other terminals should be empty but only wiring terminals mention in this manual. | ||
43 | |||
44 | (% style="text-align:center" %) | ||
45 | [[image:LCM-16EX User manual_html_5bc4b53029347d0f.png||height="147" width="300" class="img-thumbnail"]] | ||
46 | ))) | ||
47 | |||
48 | = **3 Input specification** = | ||
49 | |||
50 | (% border="1" class="table-bordered" %) | ||
51 | |**Item**|**DC input** | ||
52 | |Mode|LCM-16EX | ||
53 | |Output circuit|[[image:image-20230107103618-2.png||height="432" width="263"]]((( | ||
54 | |||
55 | ))) | ||
56 | |Input voltage|DC ± 24V ± 10% *1 | ||
57 | |Input current|5mA/ DC 24V | ||
58 | |Input ON current|More than 3.5mA | ||
59 | |Input OFF current|Less than 1.5mA | ||
60 | |(% rowspan="2" %)Input response time|About 10ms | ||
61 | |X0~~X7 built-in digital filter | ||
62 | |Input signal|Contactor NPN or PNP | ||
63 | |Circuit insulation|Photo-coupling | ||
64 | |LED|Lights when input is energized | ||
65 | |||
66 | *1 DC Power,follow the power supply voltage range of each unit | ||
67 | |||
68 | = **4 Modbus communication** = | ||
69 | |||
70 | == **4.1 Com port communication configuration** == | ||
71 | |||
72 | (% border="1" %) | ||
73 | |(% colspan="2" %)**Com port comm. configuration** | ||
74 | |Station No.|1~~32 (Adjust by DIP switch) | ||
75 | |Baud rate|9600~~115200 (Adjust by DIP switch) | ||
76 | |Stop bit|1 | ||
77 | |Data bit|8 | ||
78 | |parity|even | ||
79 | |||
80 | == **4.2 Module communication mode (function code)** == | ||
81 | |||
82 | LCM-16EX communication with coil :01(read coil), 05(write signal coil), 15(write continuous coils) | ||
83 | |||
84 | **1.0x01(Read coil)** | ||
85 | |||
86 | Request (by Master) | ||
87 | |||
88 | (% border="1" %) | ||
89 | |Slave Station|1 byte|Slave station | ||
90 | |Function code|1 byte|0x01 | ||
91 | |Start address|2 byte|0x0000 to 0x000F | ||
92 | |Coil address No.|2 byte|1 to 16 | ||
93 | |CRC|2 byte|CRC | ||
94 | |||
95 | Response (by slave) | ||
96 | |||
97 | (% border="1" %) | ||
98 | |Slave station|1 byte|Slave station | ||
99 | |Function code|1 byte|0x01 | ||
100 | |Byte No.|1 byte|N | ||
101 | |Coil states|N byte|n=N or N+1 | ||
102 | |CRC|2 byte|CRC | ||
103 | |||
104 | N=Output number/8, if remainder is not equal to 0, then N=N+1 | ||
105 | |||
106 | Error (Slave respond) | ||
107 | |||
108 | (% border="1" %) | ||
109 | |Slave station|1 byte|Slave station | ||
110 | |Error code|1 byte|0x81 | ||
111 | |Exception code|1 byte|((( | ||
112 | 01 (cannot support this function) | ||
113 | |||
114 | 02 (Address crossing domain) | ||
115 | ))) | ||
116 | |CRC|2 byte|CRC | ||
117 | |||
118 | Example: read 0x0000-0x0007 coils address | ||
119 | |||
120 | (% border="1" %) | ||
121 | |(% colspan="2" %)**Request (by Master)**|(% colspan="2" %)**Respond(By slave)** | ||
122 | |Slave|0A|Slave|0A | ||
123 | |Function code|01|Function code|01 | ||
124 | |Coil high start address|00|Byte No.|01 | ||
125 | |Coil low start address|00|Output states (0-7)|FF | ||
126 | |Read number (High 8 bits)|00|CRC Low bit|13 | ||
127 | |Read number (Low 8 bits)|08|CRC High bit|EC | ||
128 | |CRC Low bit|B7| | | ||
129 | |CRC High bit|3C| | | ||
130 | |||
131 | **2.0x05(Write signal coil)** | ||
132 | |||
133 | Request (By Master) | ||
134 | |||
135 | (% border="1" %) | ||
136 | |Slave station|1 byte|Slave station | ||
137 | |Function code|1 byte|0x05 | ||
138 | |Output address|2 byte|0x0000 to 0x000F | ||
139 | |Output value|2 byte|0x0000(Write 0) or 0xFF00 (Write 1) | ||
140 | |CRC|2 byte|CRC | ||
141 | |||
142 | Respond (By Slave) | ||
143 | |||
144 | (% border="1" %) | ||
145 | |Slave station|1 byte|Slave station | ||
146 | |Function code|1 byte|0x05 | ||
147 | |Output address|2 byte|0x0000 to 0x000F | ||
148 | |Output value|2 byte|0x0000 or 0xFF00 | ||
149 | |CRC|2 byte|CRC | ||
150 | |||
151 | Error Respond (By Slave) | ||
152 | |||
153 | (% border="1" %) | ||
154 | |Slave station|1 byte|Slave station | ||
155 | |Error code|1 byte|0x85 | ||
156 | |Exception code|1 byte|((( | ||
157 | 01 (cannot support this function code) | ||
158 | |||
159 | 02 (Address crossing domain) | ||
160 | ))) | ||
161 | |CRC|2 byte|CRC | ||
162 | |||
163 | Example: write 0x000 address coil | ||
164 | |||
165 | (% border="1" %) | ||
166 | |(% colspan="2" %)**Request(by master)**|(% colspan="2" %)**Respond(by slave)** | ||
167 | |Slave Station|0A|Slave station|0A | ||
168 | |Function code|05|Function code|05 | ||
169 | |Coil high start address|00|Coil high start address|00 | ||
170 | |Coil low start address|00|Coil low start address|00 | ||
171 | |Write number(High 8 bits)|FF|Write number(High 8 bits)|FF | ||
172 | |Write number(Low 8 bits)|00|Write number(Low 8 bits)|00 | ||
173 | |CRC Low bit|BD| |BD | ||
174 | |CRC High bit|41| |41 | ||
175 | |||
176 | **3.0x0F (Write continuous coil)** | ||
177 | |||
178 | Request (by Master) | ||
179 | |||
180 | (% border="1" %) | ||
181 | |Slave station|1 byte|Slave station | ||
182 | |Function code|1 byte|0x0F | ||
183 | |Start address|2 byte|0x0000 to 0x000F | ||
184 | |Output number|2 byte|1 to 16 | ||
185 | |Byte number|1 byte|N | ||
186 | |Output value|N*1 byte| | ||
187 | |CRC|2 byte|CRC | ||
188 | |||
189 | N=Output value/8,if remainder is not equal to 0,then N=N+1 | ||
190 | |||
191 | Respond (by slave) | ||
192 | |||
193 | (% border="1" %) | ||
194 | |Slave station|1 byte|Slave station | ||
195 | |Function code|1 byte|0x0F | ||
196 | |Start address|2 byte|0x0000 to 0x000F | ||
197 | |Output value|2 byte|1 to 16 | ||
198 | |CRC|2 byte|CRC | ||
199 | |||
200 | Error Respond (By Slave) | ||
201 | |||
202 | (% border="1" %) | ||
203 | |Slave station|1 byte|Slave station | ||
204 | |Error code|1 byte|0x8F | ||
205 | |Exception code|1 byte|((( | ||
206 | 01 (can not support this function code) | ||
207 | |||
208 | 02 (Address crossing domain) | ||
209 | ))) | ||
210 | |CRC|2 byte|CRC | ||
211 | |||
212 | Example: Write 0x0000 address to 0x0007 coil | ||
213 | |||
214 | (% border="1" %) | ||
215 | |(% colspan="2" %)**Master request**|(% colspan="2" %)**Slave respond** | ||
216 | |Slave station|0A|Slave station|0A | ||
217 | |Function code|0F|Function code|0F | ||
218 | |Coil high start address|00|Coil high start address|00 | ||
219 | |Coil low start address|00|Coil low start address|00 | ||
220 | |Operations number high 8 bit|00|Operations number high 8 bit|00 | ||
221 | |Operations number low 8 bit|08|Operations number low 8 bit|08 | ||
222 | |Byte number|01|CRC low bit|55 | ||
223 | |Write number|88|CRC high bit|76 | ||
224 | |CRC low bit|40| | | ||
225 | |CRC high bit|BF| | | ||
226 | |||
227 | == **4.3 Introduction of DIP switch** == | ||
228 | |||
229 | **1.DIP switch introduction** | ||
230 | |||
231 | (% style="text-align:center" %) | ||
232 | [[image:LCM-16EX User manual_html_93aa56002bebd679.png||height="191" width="400" class="img-thumbnail"]] | ||
233 | |||
234 | |||
235 | (% style="text-align:center" %) | ||
236 | [[image:LCM-16EX User manual_html_79b07e8411c992f6.png||height="817" width="600" class="img-thumbnail"]] | ||
237 | |||
238 | Figure 4‑1 DIP switch | ||
239 | |||
240 | **✎Note: ** | ||
241 | |||
242 | In practical use, the dial switch is ON (1) downward and OFF (0) upward. As shown in the figure, the status of the DIP switch is downward, all are ON. | ||
243 | |||
244 | **2.DIP switch and station setting** | ||
245 | |||
246 | In practical use, the # 1 to # 5 of the DIP switch is used for the selection of the module station number, and the relationship between the station number and the 1 # 5 dial number switch is shown in the following table: | ||
247 | |||
248 | (% border="1" %) | ||
249 | |**#1 DIP switch**|**#2 DIP switch**|**#3 DIP switch**|**#4 DIP switch**|**#5 DIP switch**|**Module station** | ||
250 | |0|0|0|0|0|1 | ||
251 | |1|0|0|0|0|2 | ||
252 | |0|1|0|0|0|3 | ||
253 | |1|1|0|0|0|4 | ||
254 | |0|0|1|0|0|5 | ||
255 | |1|0|1|0|0|6 | ||
256 | |0|1|1|0|0|7 | ||
257 | |1|1|1|0|0|8 | ||
258 | |0|0|0|1|0|9 | ||
259 | |1|0|0|1|0|10 | ||
260 | |0|1|0|1|0|11 | ||
261 | |1|1|0|1|0|12 | ||
262 | |0|0|1|1|0|13 | ||
263 | |1|0|1|1|0|14 | ||
264 | |0|1|1|1|0|15 | ||
265 | |1|1|1|1|0|16 | ||
266 | |0|0|0|0|1|17 | ||
267 | |1|0|0|0|1|18 | ||
268 | |0|1|0|0|1|19 | ||
269 | |1|1|0|0|1|20 | ||
270 | |0|0|1|0|1|21 | ||
271 | |1|0|1|0|1|22 | ||
272 | |0|1|1|0|1|23 | ||
273 | |1|1|1|0|1|24 | ||
274 | |0|0|0|1|1|25 | ||
275 | |1|0|0|1|1|25 | ||
276 | |0|1|0|1|1|27 | ||
277 | |1|1|0|1|1|28 | ||
278 | |0|0|1|1|1|29 | ||
279 | |1|0|1|1|1|30 | ||
280 | |0|1|1|1|1|31 | ||
281 | |1|1|1|1|1|32 | ||
282 | |||
283 | **3.DIP switch and baud rate setting** | ||
284 | |||
285 | In practical use, the #6 to #8 of the DIP switch are used for the selection of the baud rate, and the relationship between the baud rate and #6-# 8 DIP switch is shown in the following table: | ||
286 | |||
287 | (% border="1" %) | ||
288 | |**#6 DIP switch**|**#7 DIP switch**|**#8 DIP switch**|**Module baud rate** | ||
289 | |0|0|0|115200 | ||
290 | |1|0|0|57600 | ||
291 | |0|1|0|38400 | ||
292 | |1|1|0|19200 | ||
293 | |0|0|1|9600 | ||
294 | |1|0|1|Reserved for later expansion (Default: 115200) | ||
295 | |0|1|1|Reserved for later expansion (Default: 115200) | ||
296 | |1|1|1|Reserved for later expansion (Default: 115200) | ||
297 | |||
298 | == **4.4 Note** == | ||
299 | |||
300 | Communication function are different between LCM-16EX module and LX3V-16EX module,but register function is same. | ||
301 | |||
302 | (% border="1" %) | ||
303 | |Module|Maximum accessible address(BFM address) | ||
304 | |16EX|15(input terminal) | ||
305 | |||
306 | = **5 Example** = | ||
307 | |||
308 | Set DIP switch according to 4.2 section introduces, the module station is 2, and baud rate is 115200. The 16 input terminal of the LCM-16EX module are mapped to M10~~M25. | ||
309 | |||
310 | (% style="text-align:center" %) | ||
311 | [[image:LCM-16EX User manual_html_da1804bfa712cd21.png||height="521" width="700" class="img-thumbnail"]] | ||
312 | |||
313 | **Project explanation** | ||
314 | |||
315 | 1)Step 0~~16: This is for setting communication protocol and communication parameters; | ||
316 | |||
317 | * Set PLC com2 as Modbus Master; | ||
318 | * Set stop bit =1, data bit=8, Even parity, baud rate=115200(Please check detail in PLC COM2 Modbus setting manual) | ||
319 | |||
320 | 2)Step 16~~47: 16 input terminal of the LCM-16EX module are mapped to M10~~M25 |