Wiki source code of LX3V-4AD

Last modified by Devin Chen on 2024/11/27 15:04

Show last authors
1 = **1 Introduction** =
2
3 * The LX3V-4AD special module has four input channels. The input channels receive analog signals and convert them into a digital value. This is called an A/D conversion; the maximum resolution is 16 bits.
4 * The selection of voltage or current based input/output is by user wiring. Analog ranges of -10 to 10V DC (resolution: 5mV), and/or 4 to 20mA, -20 to 20mA (resolution: 20µA) may be selected.
5 * Data transfer between the LX3V-4AD and the LX3V main unit is by buffer memory exchange. There are 32 buffer memories (each of 16 bits) in the LX3V-4AD.
6 * LX3V-4AD consumes 5V voltage from LX3V main unit or active extension unit, 90mA current of power supply.
7
8 = **2 Dimensions** =
9
10 (% style="text-align:center" %)
11 [[image:LX3V-4AD_html_5159808b9e4fa86a.png||height="391" width="1000" class="img-thumbnail"]]
12
13 1. (((
14 Extension cable and connector
15 )))
16 1. (((
17 COM LED: Light when communicating Error LED: Channel calibration indicators
18 )))
19 1. (((
20 Power LED: Light when connect to 24V
21 )))
22 1. (((
23 State LED: Light when normal condition
24 )))
25 1. (((
26 Link LED: Light when communicate with PLC
27 )))
28 1. (((
29 Module name
30 )))
31 1. (((
32 Extension module interface
33 )))
34 1. (((
35 DIN rail mounting slot
36 )))
37 1. (((
38 DIN rail hook
39 )))
40 1. (((
41 Holes for direct installation: 2 places (Φ4.5)
42 )))
43
44 (((
45 (% style="margin-left:auto; margin-right:auto" %)
46 |=**Name**|=**Description**|=**Light status**|=**Event status**
47 |(% rowspan="2" %)(((
48 COM LED
49
50
51 )))|(% rowspan="2" %)(((
52 Communication indicator for communication board and acquisition board
53
54
55 )))|Flashing|Data interacting
56 |Off|Data interaction error/stop/failure
57 |(% rowspan="2" %)(((
58 ERR LED
59
60
61 )))|(% rowspan="2" %)(((
62 Factory calibration LED
63
64
65 )))|Off|Factory calibrated
66 |Lighting|Factory uncalibrated
67 |(% rowspan="2" %)(((
68 24V LED
69
70
71 )))|(% rowspan="2" %)(((
72 Power indicator
73
74
75 )))|Off|24V power is abnormal.
76 |Lighting|24V power is normal.
77 |(% rowspan="3" %)(((
78 LINK LED
79
80
81 )))|(% rowspan="3" %)(((
82 Communication indicator for PLC and expansion module
83
84
85 )))|Flashing|Data interacting
86 |Off|Data interaction error/stop/failure
87 |Lighting|Software running abnormal or hardware failure
88 |(% rowspan="3" %)(((
89 AD LED
90
91
92 )))|(% rowspan="3" %)(((
93 4 channel indicators
94
95
96 )))|Flashing|Input voltage or current range exceed limit or channel unconnected
97 |Off|Channel closed
98 |Lighting|Input analog is in the normal range
99
100 (% style="text-align:center" %)
101 [[image:LX3V-4AD_html_5bc4b53029347d0f.png||height="309" width="618" class="img-thumbnail"]]
102
103
104 Please use crimp terminals as indicated on the graph.
105
106 The tightening torque should be applied 5 to 8 Kg.cm.
107
108 = **3 Terminal layouts** =
109
110 (% style="text-align:center" %)
111 [[image:image-20220728103451-1.png||class="img-thumbnail"]]
112 )))
113
114 (((
115 1. The analog input is received through a twisted pair shielded cable. This cable should be wired separately from power lines or any other lines which may induce electrical noise.
116 1. If a voltage ripple occurs during input, or there is electrically induced noise on the external wiring, connect a smoothing capacitor of 0.1 to 0.47µF, 25V.
117 1. If you are using current input, connect the V+ and I+ terminals to each other.
118 1. If there is excessive electrical noise, connect the FG frame ground terminal with the grounded terminal on the LX3V-4AD.
119 1. Connect the ground terminal on the LX3V-4AD unit with the grounded terminal on the main unit. Use class 3 grounding on the main unit, if available.
120
121 **Note: when connect a 4-20ma sensor(need +24V working voltage), the wiring is as below:**
122
123 [[image:企业微信截图_16771315134574.png]]
124
125 = **4 Installation** =
126 )))
127
128 **Environment specification**
129
130 (% class="table-bordered" %)
131 |=(% style="width: 490px;" %)**Item**|=(% style="width: 585px;" %)**Specification**
132 |(% style="width:490px" %)Environmental specifications (excluding following)|(% style="width:585px" %)Same as those for the LX3V main unit
133 |(% style="width:490px" %)Dielectric withstand voltage|(% style="width:585px" %)500VAC, 1min (between all terminals and ground)
134
135 **Power supply specification**
136
137 (% class="table-bordered" %)
138 |=(% style="width: 294px;" %)**Item**|=(% style="width: 781px;" %)**Specification**
139 |(% style="width:294px" %)Analog circuits|(% style="width:781px" %)24V DC ± 10%, 55mA (external power supply from main unit)
140 |(% style="width:294px" %)Digital circuits|(% style="width:781px" %)5V DC, 90mA (internal power supply from main unit)
141
142 **Performance specification**
143
144 **Analog Inputs**
145
146 (% style="margin-left:auto; margin-right:auto" %)
147 |= |=**Voltage Input**|=**Current input**
148 |=**Items**|(% colspan="2" %)Either voltage or current input can be selected with your choice of input terminal. Up to four input points can be used at one time.
149 |=**Analog input range**|(((
150 DC -10V to +10V (input resistance: 200kΩ).
151
152 Warning: this unit may be damaged by input voltage in excess of ±15V
153 )))|(((
154 DC -20mA to +20mA (input resistance: 250Ω).
155
156 Warning: this unit may be damaged by input currents in excess of ±32mA.
157 )))
158 |=**Digital output**|(% colspan="2" %)(((
159 12-bit conversion stored in 16-bit 2’s complement form
160
161 Maximum value: +2047 Minimum value: -2048
162 )))
163 |=**Analog accuracy**|±1% (for the range of -10V to +10V)|±1% (for the range of -20mA to +20mA)
164 |=(((
165 **Conversion**
166
167 **time for each channel**
168 )))|(% colspan="2" %)Tconv ≤10ms (High-speed), 10ms≤Tconv≤20ms (Middle speed), Tconv>20ms (Low speed)
169
170 **Analog Inputs continued...**
171
172 (% class="table-bordered" %)
173 |=**Preset 0 (-10V to +10V)**|=**Preset 1 (+4mA to +20mA)**|=**Preset 2 (-20mA to +20mA)**
174 |[[image:LX3V-4AD_html_8bdc9efc08b433c8.png||height="371" width="420" class="img-thumbnail"]]|[[image:LX3V-4AD_html_a268382a2adb0b80.png||height="345" width="420" class="img-thumbnail"]]|[[image:LX3V-4AD_html_a58cfb9f37ade123.png||height="363" width="420" class="img-thumbnail"]]
175
176 (% class="box infomessage" %)
177 (((
178 **✎Note: **Preset ranges are selected by an appropriate setting in buffer memory of the analog block. Current/Voltage input selection must match the correct input terminal connections.
179 )))
180
181 **Miscellaneous**
182
183 (% class="table-bordered" %)
184 |=(% scope="row" style="width: 147px;" %)**Item**|=(% style="width: 928px;" %)**Description**
185 |=(% style="width: 147px;" %)Isolation|(% style="width:928px" %)(((
186 Photo-couple isolation between analog and digital circuits. DC/DC converter isolation of power from LX3VCPU.
187
188 No isolation between analog channels.
189 )))
190
191 **Allocation of buffer memories (BFM)**
192
193 (% style="margin-left:auto; margin-right:auto" %)
194 |=**BFM**|=(% colspan="9" %)**Description**
195 |*#0|(% colspan="9" %)Channel initialization, default=H0000
196 |*#1|Channel 1|(% colspan="8" rowspan="4" %)(((
197 Contains the number of samples (1 to 4096) to be used for an averaged result.
198
199 The default setting is 8-normal speed. High speed operation can be selected with a value of 1.
200 )))
201 |*#2|Channel 2
202 |*#3|Channel 3
203 |*#4|Channel 4
204 |#5|Channel 1|(% colspan="8" rowspan="4" %)These buffer memories contain the averaged input values for the number of samples entered for the channel in buffer memories #1 to #4 respectively.
205 |#6|Channel 2
206 |#7|Channel 3
207 |#8|Channel 4
208 |#9|Channel 1|(% colspan="8" rowspan="4" %)These buffer memories contain the present value currently being read by each input channel.
209 |#10|Channel 2
210 |#11|Channel 3
211 |#12|Channel 4
212 |#13-#14|(% colspan="9" %)Reserved
213 |(% rowspan="10" %)#15|(% rowspan="10" %)(((
214 Selection of A/D conversion speed
215
216 Please refer to note 2
217 )))|(% colspan="4" %)Set value|(% colspan="4" %)(((
218 Conversion time
219
220 (Unit: ms/channel)
221 )))
222 |(% colspan="4" %)0 (Default)|(% colspan="4" %)15
223 |(% colspan="4" %)1|(% colspan="4" %)6
224 |(% colspan="4" %)10|(% colspan="4" %)3
225 |(% colspan="4" %)11|(% colspan="4" %)4.5
226 |(% colspan="4" %)12|(% colspan="4" %)7
227 |(% colspan="4" %)13|(% colspan="4" %)12.5
228 |(% colspan="4" %)14|(% colspan="4" %)23.5
229 |(% colspan="4" %)15|(% colspan="4" %)45.5
230 |(% colspan="4" %)16|(% colspan="4" %)101
231 |#16-#19|(% colspan="9" %)Reserved
232 |*#20|(% colspan="9" %)Reset to Defaults and Preset. Default = 0
233 |*#21|(% colspan="9" %)(((
234 Offset, Gain Adjust Prohibit.
235
236 Default = (0, 1) Permit
237 )))
238 |*#22|Offset, Gain Adjust|G4|04|G3|03|G2|01|G1|01
239 |*#23|(% colspan="9" %)Offset Value    Default = 0
240 |*#24|(% colspan="9" %)Gain Value      Default = 5,000
241 |#25-#28|(% colspan="9" %)Reserved
242 |#29|(% colspan="9" %)Error status
243 |#30|(% colspan="9" %)(((
244 Identification code K2010 (12-bit resolution)
245
246 Identification code K2011 (16-bit resolution)
247 )))
248 |#31|(% colspan="9" %)Hardware version
249
250 (% class="box infomessage" %)
251 (((
252 **✎Note: **
253
254 * In buffer memory locations (BFM’s) marked with an “*” data can be written from the PC using the TO command.
255 * For buffer memories (BFM’s) without “*”mark, data can be read to the PC using the FROM command.
256 * Before reading from the analog special function block, ensure these settings have been sent to the analog special function block. Otherwise, the previous values held in the analog block will be used.
257 * Offset (intercept): The analog input value when the digital output becomes 0.
258 * Gain (slope): The analog input value when the digital output becomes +1000.
259 )))
260
261 **Channel Selection**
262
263 Channel initialization is made by a 4 character HEX number HOOOO in buffer memory BFM #0. The least significant character controls channel 1 and the 4 character controls channel4.
264
265 (% class="table-bordered" %)
266 |=(% scope="row" %)**BFM#0**|=**Analog input**|=**Digital output**|=**Resolution**|=**Offset/Gain**|=**Constant**
267 |=0|-10V~~10V|-2000~~2000|5 mV|0/5000|1000
268 |=1|4mA~~20mA|0~~1000|16µA|4000/20000|1000
269 |=2|-20mA~~20mA|-1000~~1000|20µA|0/20000|1000
270 |=3|Disabled|/|/|/|/
271 |=4|-10V~~10V|-10000~~10000|1mV|0/5000|10000
272 |=5|4 mA ~~20mA|0~~10000|1.6µA|4000/20000|10000
273 |=6|-20mA~~20mA|-10000~~10000|2.0µA|0/20000|10000
274
275 **Example: H3310**
276
277 * CH1: Preset range (-10V to +10V).
278 * CH2: Preset range (+4mA to +20mA).
279 * CH3, CH4: Channel OFF.
280
281 **Analog to Digital Conversion Speed Change**
282
283 By writing 0, 1 or decimal numbers between 10-16 into BFM#15 of the LX3V-4AD, the time at which A/D conversion is performed can be changed.
284
285 However, the following points should be noted:
286
287 1. To maintain a high-speed conversion, please use the FROM/TO commands as seldom as possible.
288 1. When a conversion speed change occurs, BFM #1-#4 are set to their default values immediately after the change. Please be careful if an A/D time conversion will be part of the normal program execution.
289 1. High-speed time conversion is usually used with BFM#1-#4.
290 1. BFM#15 is configurated with the corresponding conversion time of 10-16, only supported by software version 20000 or above.
291
292 **Adjusting Gain and Offset values**
293
294 **Formula for Gain/Offset: Digital output= (Analog input-Offset)*Constant/ (Gain-Offset)**
295
296 * When buffer memory BFM #20 is activated by setting it to K1, all settings within the analog special function block are reset to their default settings. This is a very quick method to erase any undesired gain and offset adjustments.
297 * If (b1, b0) of BFM #21 is set to (1, 0), gain and offset adjustments are prohibited to prevent inadvertent changes by the operator. In order to adjust the gain and offset values, bits (b1, b0) must be set to (0, 1). The default is (0, 1).
298 * Gain and offset values of BFM #23 and #24 are sent to non-volatile memory gain and offset registers of the specified input channels. Input channels to be adjusted are specified by the appropriate G-O (gain-offset) bits of BFM #22.
299 * (((
300 Example:
301
302 If bits G1 and O1 are set to 1, input channel 1 will be adjusted when BFM #22 is written to by a TO instruction.
303 )))
304 * Channels can be adjusted individually or together with the same gain and offset values.
305 * Gain and offset values in BFM #23 #24 are in units of mV or µA. Due to the resolution of the unit the actual response will be in steps of 5mV or 20µA.
306 * When gain is less than or equal to offset, error will be adjusted. Gain and offset will not change. Error status will be given at BFM#29 b1. B4-b7 will give a specific channel offset/gain error.
307
308 Example:
309
310 If bits G1 and O1 are set to 1, input channel 1 will be adjusted when BFM #22 is written to by a TO instruction.
311
312 * Channels can be adjusted individually or together with the same gain and offset values.
313 * Gain and offset values in BFM #23 #24 are in units of mV or µA. Due to the resolution of the unit the actual response will be in steps of 5mV or 20µA.
314
315 **Status Information BFM #29**
316
317 (% style="margin-left:auto; margin-right:auto" %)
318 |=**Bit devices of BFM #29**|=**ON**|=**OFF**
319 |b0: Error|When any of b1 to b4 is ON. If any of b2 to b4 is ON, A/D conversion of all the channels is stopped|No error
320 |b1: Offset/gain error|Offset/Gain data in EEPROM is corrupted or adjustment error.|Offset/Gain data normal
321 |b2: Power source abnormality|24V DC power supply failure|Power supply normal
322 |b3: Hardware error|A/D converter or other hardware failure|Hardware normal
323 |b4: Channel 1 offset/gain error|(% rowspan="4" %)When channel offset/gain error is modified, the corresponding position is ON.|(% rowspan="4" %)Offset/Gain adjustment normal
324 |b5: Channel 2 offset/gain error
325 |b6: Channel 3 offset/gain error
326 |b7: Channel 4 offset/gain error
327 |b10: Digital range error|Digital output value is less than -2048 or more than +2047|Averaging is normal. (Between 1 and 4096)
328 |b11: Averaging error|Number of averaging samples is 4097 or more or 0 or less (default of 8 will be used)|Averaging is normal. (Between 1 and 4096)
329 |b12: Adjust prohibit|Prohibit-(b1, b0) of BFM #21 is set to (1, 0)|Permit-(b1, b0) of BFM #21 is set to (0,1)
330
331 (% class="box infomessage" %)
332 (((
333 **✎Note: **b8, b9 and b13 to b15 are undefined.
334 )))
335
336 **Identification Code BFM #30**
337
338 The identification (or ID) code number for a Special Function Block is read using the FROM command.
339
340 This number for the LX3V-4AD unit is K2011 or K2010.
341
342 The user’s program in the PC can use this facility in the program to identify the special function block before commencing data transfer from and to the special function block.
343
344 (% class="box infomessage" %)
345 (((
346 **✎Note: **
347
348 * Values of BFM #0, #23 and #24 are copied to EEPROM memory of the LX3V-4AD. BFM #21 and BFM #22 are only copied when data is written to the gain/offset command buffer BFM #22. Also, BFM #20 causes writing to the EEPROM memory. The EEPROM has a life of about 10,000 cycles (changes), so do not use programs which frequently change these BFMs.
349
350 * Because of the time needed to write to the EEPROM memory, a delay of 300 ms is required between instructions that cause a write to the EEPROM. Therefore, a delay timer should be used before writing to the EEPROM a second time.
351 )))
352
353 = **5 Defining gain and offset** =
354
355 Gain determines the angle or slope of the calibration line, identified at a digital value of 1000.
356
357 * (a) Small gain: Large steps in digital readings
358 * (b) Zero gain: Default is 5V or 20mA.
359 * (c) Large gain: Small steps in digital readings.
360
361 Offset is the “Position” of the calibrated line, identified at a digital value of 0.
362
363 * (d) Negative offset.
364 * (e) Zero offset: Default is 0V or 4mA.
365 * (f) Positive offset.
366
367 (% style="text-align:center" %)
368 [[image:LX3V-4AD_html_f78533c1d988f63f.png||height="298" width="800" class="img-thumbnail"]]
369
370 Offset and gain can be set independently or together. Reasonable offset ranges are -5 to +5V or -20mA to 20mA, and gain values 1V to 15V or 4mA to 32mA. Gain and offset can be adjusted by software in the LX3V main unit (please refer to program example 2).
371
372 * Bit device’s b1, b0 of the gain/offset BFM #21 should be set to 0, 1 to allow adjustment.
373 * Once adjustment is complete these bit devices should be set to 1, 0 to prohibit any further changes.
374 * Channel initialization (BFM #0) should be set to the nearest range, i. e. voltage/current etc.
375
376 = **6 Example program** =
377
378 **Basic program**
379
380 In the following example channels CH1 and CH2 are used as voltage inputs. The LX3V-4AD block is connected at the position of special function block No.0. Averaging is set at 4 and data registers D0 and D1 of the PC receive the averaged digital data. The FROM code for the special function block at position “0" is read from BFM #30 of that block and stored at D4 in the main unit. CMP is compared to check the block is a LX3V-4AD, if OK M1 is turned ON.
381
382 [[image:LX3V-4AD_html_e3a9b9608260f138.png||height="297" style="float:left" width="600" class="img-thumbnail"]]
383
384 **✎Note: **
385
386 1. TO code: The analog input channels (CH1, CH2) are setup by writing H3300 to BFM #0 of the LX3V-4AD
387 1. The number of averaged samples for CH1 and CH2 is set to 4 by writing 4 to BFM #1 and #2 respectively.
388 1. The operational status of the LX3V-4AD is read from BFM #29 and output as bit devices at the LX3V main unit. If there are no errors in the operation of the LX3V-4AD, then the averaged data BFM’s are read.
389 1. In the case of this example BFM #5 and #6 are read into the LX3V main unit and stored at D0 and D1. These devices contain the averaged data for CH1 and CH2 respectively.
390
391 **Using gain and offset in a program**
392
393 The gain and offset of the LX3V-4AD can be adjusted using push-button switches on the input terminal of the PC. It can also be adjusted using software settings sent from the PC.
394
395 Only the gain and offset values in the memory of the LX3V-4AD need be adjusted. A voltmeter or an ammeter for the analog input is not needed. A program for the PC will be needed however.
396
397 The following is an example of changing the offset value on input channel CH1 to 0V and the gain value to 2.5V.
398
399 The LX3V-4AD block is in the position of block No.0 (i.e. closest to the LX3V main unit).
400
401 Example: Adjusting gain/offset via software settings
402
403 (% style="text-align:center" %)
404 [[image:LX3V-4AD_html_41bef52ee180f2c9.png||height="980" width="600" class="img-thumbnail"]]
405
406 (((
407 Adjustment start
408
409 * (H0000)->BFM#0 (initialize input channels). Enter the instructions on the left and RUN the PC
410 * (K1)->BFM#21. BFM#21 must be set to permit with (b1, b0)=(0,1)
411 * (K0)->BFM#22 (offset/gain adjusts). Reset adjust bits
412 * (K0)-> BFM#23 (offset)
413 * (K2500)-> BFM#24 (gain)
414 * (H0003)->BFM#22(offset/gain adjusts). 3=0011 i.e. O1=1, G1=1. Therefore channel 1 is adjusted.
415
416 Adjustment ends.
417
418 (K2)-> BFM#21. BFM#21 gain/offset adjust prohibit
419
420 **High-speed conversion by changing A/D conversion time in a program**
421
422 **[[image:6.3-图片1.png]]**
423 )))
424
425 Writing K10 to BFM#15 and set conversion time of all channels as 3ms.
426
427 Writing 1 to BFM#1 and set Channel 1 sample count to 1 to Channel 1 high-speed conversion.
428
429 = **7 Diagnostics** =
430
431 **Preliminary checks**
432
433 1. Check whether the input wiring and/or extension cables are properly connected on LX3V-4AD analog special function block.
434 1. Check that the LX3V system configuration rules have not been broken, i.e. the number of special function blocks does not exceed 8 and the total system I/O is equal or less than 256 I/O.
435 1. Ensure that the correct operating range has been selected for the application.
436 1. Check that there is no power overload on either the 5V or 24V power sources, remember the loading on a LX3V main unit or a powered extension unit varies according to the number of extension blocks or special function blocks connected.
437 1. Put the LX3V main unit into RUN.
438
439 **Error checking**
440
441 If the LX3V-4AD special function block does not seem to operate normally, check the following items.
442
443 Check the status of the POWER LED.
444
445 Lit: The extension cable is properly connected.
446
447 Otherwise: Check the connection of the extension cable.
448
449 * Check the external wiring.
450 * Check the status of the “24V” LED (top right corner of the LX3V-4AD).
451
452 Lit: LX3V-4AD is OK; 24V DC power source is OK.
453
454 Otherwise: Possible 24VDC power failure, if OK possible LX3V-4AD failure.
455
456 * Check the status of the “A/D” LED (top right corner of the LX3V-4AD).
457
458 Lit: A/D conversion is proceeding normally.
459
460 Otherwise: Check buffer memory #29 (error status). If any bits (b2 and b3) are ON, then this is why the A/D LED is OFF.