Wiki source code of LX3V-4AD

Version 4.1 by Stone Wu on 2022/09/14 16:00

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. Extension cable and connector
14 1. COM LED: Light when communicating
15 1. Power LED: Light when connect to 24V
16 1. State LED: Light when normal condition
17 1. Module name
18 1. Analog signal output terminal
19 1. Extension module interface
20 1. DIN rail mounting slot
21 1. DIN rail hook
22
23 (((
24 Please use crimp terminals as indicated on the graph.
25
26 The tightening torque should be applied 5 to 8 Kg.cm.
27
28 (% style="text-align:center" %)
29 [[image:LX3V-4AD_html_5bc4b53029347d0f.png||height="195" width="400" class="img-thumbnail"]]
30
31 = **3 Terminal layouts** =
32
33 (% style="text-align:center" %)
34 [[image:image-20220728103451-1.png||class="img-thumbnail"]]
35 )))
36
37 (((
38 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.
39 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.
40 1. If you are using current input, connect the V+ and I+ terminals to each other.
41 1. If there is excessive electrical noise, connect the FG frame ground terminal with the grounded terminal on the LX3V-4AD.
42 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.
43
44 (% style="text-align:center" %)
45 [[image:4-20mA 2-wire.png||height="528" width="600" class="img-thumbnail"]]
46
47 (% style="text-align:center" %)
48 [[image:4-20mA 3-wire.png||height="510" width="600" class="img-thumbnail"]]
49
50 = **4 Installation** =
51 )))
52
53 **Environment specification**
54
55 (% class="table-bordered" %)
56 |=(% style="width: 490px;" %)**Item**|=(% style="width: 585px;" %)**Specification**
57 |(% style="width:490px" %)Environmental specifications (excluding following)|(% style="width:585px" %)Same as those for the LX3V main unit
58 |(% style="width:490px" %)Dielectric withstand voltage|(% style="width:585px" %)500VAC, 1min (between all terminals and ground)
59
60 **Power supply specification**
61
62 (% class="table-bordered" %)
63 |=(% style="width: 294px;" %)**Item**|=(% style="width: 781px;" %)**Specification**
64 |(% style="width:294px" %)Analog circuits|(% style="width:781px" %)24V DC ± 10%, 55mA (external power supply from main unit)
65 |(% style="width:294px" %)Digital circuits|(% style="width:781px" %)5V DC, 90mA (internal power supply from main unit)
66
67 **Performance specification**
68
69 **Analog Inputs**
70
71 (% class="table-bordered" %)
72 |=(% scope="row" style="width: 146px;" %) |=(% style="width: 455px;" %)**Voltage Input**|=(% style="width: 475px;" %)**Current input**
73 |=(% style="width: 146px;" %)**Items**|(% colspan="2" style="width:930px" %)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.
74 |=(% style="width: 146px;" %)**Analog input range**|(% style="width:455px" %)(((
75 DC -10V to +10V (input resistance: 200kΩ).
76
77 Warning: this unit may be damaged by input voltage in excess of ±15V
78 )))|(% style="width:475px" %)(((
79 DC -20mA to +20mA (input resistance: 250Ω).
80
81 Warning: this unit may be damaged by input currents in excess of ±32mA.
82 )))
83 |=(% style="width: 146px;" %)**Digital output**|(% colspan="2" style="width:930px" %)(((
84 12-bit conversion stored in 16-bit 2’s complement form
85
86 Maximum value:+2047 Minimum value:-2048
87 )))
88 |=(% style="width: 146px;" %)**Analog accuracy**|(% style="width:455px" %)±1% (for the range of -10V to +10V)|(% style="width:475px" %)±1% (for the range of -20mA to +20mA)
89 |=(% style="width: 146px;" %)(((
90 **Conversion**
91
92 **speed**
93 )))|(% colspan="2" style="width:930px" %)15ms/channel (Normal speed), 6ms/channel (High speed)
94
95 **Analog Inputs continued...**
96
97 (% class="table-bordered" %)
98 |=**Preset 0 (-10V to +10V)**|=**Preset 1 (+4mA to +20mA)**|=**Preset 2 (-20mA to +20mA)**
99 |[[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"]]
100
101 (% class="box infomessage" %)
102 (((
103 **✎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.
104 )))
105
106 **Miscellaneous**
107
108 (% class="table-bordered" %)
109 |=(% scope="row" style="width: 147px;" %)**Item**|=(% style="width: 928px;" %)**Description**
110 |=(% style="width: 147px;" %)Isolation|(% style="width:928px" %)(((
111 Photo-couple isolation between analog and digital circuits. DC/DC converter isolation of power from LX3VCPU.
112
113 No isolation between analog channels.
114 )))
115
116 **Allocation of buffer memories (BFM)**
117
118 (% class="table-bordered" %)
119 |=(% scope="row" style="width: 122px;" %)**BFM**|=(% colspan="9" style="width: 954px;" %)**Description**
120 |=(% style="width: 122px;" %)*#0|(% colspan="9" style="width:954px" %)Channel initialization, default=H0000
121 |=(% style="width: 122px;" %)*#1|(% style="width:242px" %)Channel 1|(% colspan="8" rowspan="4" style="width:712px" %)(((
122 Contains the number of samples (1 to 4096) to be used for an averaged result.
123
124 The default setting is 8-normal speed. High speed operation can be selected with a value of 1.
125 )))
126 |=(% style="width: 122px;" %)*#2|(% style="width:242px" %)Channel 2
127 |=(% style="width: 122px;" %)*#3|(% style="width:242px" %)Channel 3
128 |=(% style="width: 122px;" %)*#4|(% style="width:242px" %)Channel 4
129 |=(% style="width: 122px;" %)#5|(% style="width:242px" %)Channel 1|(% colspan="8" rowspan="4" style="width:712px" %)These buffer memories contain the averaged input values for the number of samples entered for the channel in buffer memories #1 to #4 respectively.
130 |=(% style="width: 122px;" %)#6|(% style="width:242px" %)Channel 2
131 |=(% style="width: 122px;" %)#7|(% style="width:242px" %)Channel 3
132 |=(% style="width: 122px;" %)#8|(% style="width:242px" %)Channel 4
133 |=(% style="width: 122px;" %)#9|(% style="width:242px" %)Channel 1|(% colspan="8" rowspan="4" style="width:712px" %)These buffer memories contain the present value currently being read by each input channel.
134 |=(% style="width: 122px;" %)#10|(% style="width:242px" %)Channel 2
135 |=(% style="width: 122px;" %)#11|(% style="width:242px" %)Channel 3
136 |=(% style="width: 122px;" %)#12|(% style="width:242px" %)Channel 4
137 |=(% style="width: 122px;" %)#13-#14|(% colspan="9" style="width:954px" %)Reserved
138 |=(% rowspan="2" style="width: 122px;" %)#15|(% rowspan="2" style="width:242px" %)Selection of A/D conversion speed please refer to note 2|(% colspan="8" style="width:712px" %)When set to 0, a normal speed is selected of 15m/s.ch (default)
139 |=(% colspan="8" style="width: 712px;" %)When set to 1, a high speed is selected of 6m/s.ch
140 |=(% style="width: 122px;" %)#16-#19|(% colspan="9" style="width:954px" %)Reserved
141 |=(% style="width: 122px;" %)*#20|(% colspan="9" style="width:954px" %)Reset to Defaults and Preset. Default = 0
142 |=(% style="width: 122px;" %)*#21|(% colspan="9" style="width:954px" %)(((
143 Offset, Gain Adjust Prohibit.
144
145 Default = (0, 1) Permit
146 )))
147 |=(% rowspan="2" style="width: 122px;" %)*#22|(% rowspan="2" style="width:242px" %)Offset, Gain Adjust|(% style="width:74px" %)b7|(% style="width:80px" %)b6|(% style="width:84px" %)b5|(% style="width:94px" %)b4|(% style="width:100px" %)b3|(% style="width:107px" %)b2|(% style="width:120px" %)b1|b0
148 |=(% style="width: 74px;" %)G4|(% style="width:80px" %)O4|(% style="width:84px" %)G3|(% style="width:94px" %)O3|(% style="width:100px" %)G2|(% style="width:107px" %)O2|(% style="width:120px" %)G1|O1
149 |=(% style="width: 122px;" %)*#23|(% colspan="9" style="width:954px" %)Offset Value Default = 0
150 |=(% style="width: 122px;" %)*#24|(% colspan="9" style="width:954px" %)Gain Value Default = 5,000
151 |=(% style="width: 122px;" %)#25-#28|(% colspan="9" style="width:954px" %)Reserved
152 |=(% style="width: 122px;" %)#29|(% colspan="9" style="width:954px" %)Error status
153 |=(% style="width: 122px;" %)#30|(% colspan="9" style="width:954px" %)(((
154 Identification code K2010 (12-bit resolution)
155
156 Identification code K2011 (16-bit resolution)
157 )))
158 |=(% style="width: 122px;" %)#31|(% colspan="9" style="width:954px" %)Hardware version
159
160 * In buffer memory locations (BFM’s) marked with an “*” data can be written from the PC using the TO command.
161 * For buffer memories (BFM’s) without “*”mark, data can be read to the PC using the FROM command.
162 * 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.
163 * Offset (intercept): The analog input value when the digital output becomes 0.
164 * Gain (slope): The analog input value when the digital output becomes +1000.
165
166 (% class="box infomessage" %)
167 (((
168 **✎Note: **
169 )))
170
171 **Channel Selection**
172
173 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.
174
175 (% class="table-bordered" %)
176 |=(% scope="row" %)**BFM#0**|=**Analog input**|=**Digital output**|=**Resolution**|=**Offset/Gain**|=**Constant**
177 |=0|-10V~~10V|-2000~~2000|5 mV|0/5000|1000
178 |=1|4mA~~20mA|0~~1000|16µA|4000/20000|1000
179 |=2|-20mA~~20mA|-1000~~1000|20µA|0/20000|1000
180 |=3|Disabled|/|/|/|/
181 |=4|-10V~~10V|-10000~~10000|1mV|0/5000|10000
182 |=5|4 mA ~~20mA|0~~10000|1.6µA|4000/20000|10000
183 |=6|-20mA~~20mA|-10000~~10000|2.0µA|0/20000|10000
184
185 **Example: H3310**
186
187 * CH1: Preset range (-10V to +10V).
188 * CH2: Preset range (+4mA to +20mA).
189 * CH3, CH4: Channel OFF.
190
191 **Analog to Digital Conversion Speed Change**
192
193 By writing 0 or 1 into BFM #15 of the LX3V-4AD, the speed at which A/D conversion is performed can be changed.
194
195 However the following points should be noted: To maintain a high speed conversion rate, use the FROM/TO commands as seldom as possible.
196
197 **✎Note: **
198
199 * When a conversion speed change is made, BFM #1-#4 are set to their default values immediately after the change. This is regardless of the values they held originally. Bear this in mind if a speed change will be made as part of the normal program execution.
200
201 **Adjusting Gain and Offset values**
202
203 **Formula for Gain/Offset: Digital output= (Analog input-Offset)*Constant/ (Gain-Offset)**
204
205 * 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.
206 * 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).
207 * 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.
208
209 Example:
210
211 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.
212
213 * Channels can be adjusted individually or together with the same gain and offset values.
214 * 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.
215
216 **Status Information BFM #29**
217
218 (% class="table-bordered" %)
219 |=(% scope="row" style="width: 209px;" %)**Bit devices of BFM #29**|=(% style="width: 564px;" %)**ON**|=(% style="width: 303px;" %)**OFF**
220 |=(% style="width: 209px;" %)b0: Error|(% style="width:564px" %)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|(% style="width:303px" %)No error
221 |=(% style="width: 209px;" %)b1: Offset/gain error|(% style="width:564px" %)Offset/Gain data in EEPROM is corrupted or adjustment error.|(% style="width:303px" %)Offset/Gain data normal
222 |=(% style="width: 209px;" %)b2: Power source abnormality|(% style="width:564px" %)24V DC power supply failure|(% style="width:303px" %)Power supply normal
223 |=(% style="width: 209px;" %)b3: Hardware error|(% style="width:564px" %)A/D converter or other hardware failure|(% style="width:303px" %)Hardware normal
224 |=(% style="width: 209px;" %)b10: Digital range error|(% style="width:564px" %)Digital output value is less than -2048 or more than +2047|(% style="width:303px" %)Averaging is normal. (between 1 and 4096)
225 |=(% style="width: 209px;" %)b11: Averaging error|(% style="width:564px" %)Number of averaging samples is 4097 or more or 0 or less (default of 8 will be used)|(% style="width:303px" %)Averaging is normal. (between 1 and 4096)
226 |=(% style="width: 209px;" %)b12: Adjust prohibit|(% style="width:564px" %)Prohibit-(b1, b0) of BFM #21 is set to (1, 0)|(% style="width:303px" %)Permit-(b1, b0) of BFM #21 is set to (0,1)
227
228 **✎Note: **b4 to b7, b9 and b13 to b15 are undefined.
229
230 **Identification Code BFM #30**
231
232 The identification (or ID) code number for a Special Function Block is read using the FROM command.
233
234 This number for the LX3V-4AD unit is K2011 or K2010.
235
236 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.
237
238 **✎Note: **
239
240 * 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.
241
242 * 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.
243
244 = **5 Defining gain and offset** =
245
246 Gain determines the angle or slope of the calibration line, identified at a digital value of 1000.
247
248 * (a) Small gain: Large steps in digital readings
249 * (b) Zero gain: Default is 5V or 20mA.
250 * (c) Large gain: Small steps in digital readings.
251
252 Offset is the “Position” of the calibrated line, identified at a digital value of 0.
253
254 * (d) Negative offset.
255 * (e) Zero offset: Default is 0V or 4mA.
256 * (f) Positive offset.
257
258 (% style="text-align:center" %)
259 [[image:LX3V-4AD_html_f78533c1d988f63f.png||height="298" width="800" class="img-thumbnail"]]
260
261 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).
262
263 * Bit device’s b1, b2 of the gain/offset BFM #21 should be set to 0, 1 to allow adjustment.
264 * Once adjustment is complete these bit devices should be set to 1, 0 to prohibit any further changes.
265 * Channel initialization (BFM #0) should be set to the nearest range, i. e. voltage/current etc.
266
267 = **6 Example program** =
268
269 **Basic program**
270
271 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.
272
273 (% style="text-align:center" %)
274 [[image:LX3V-4AD_html_e3a9b9608260f138.png||height="297" width="600" class="img-thumbnail"]]
275
276 **✎Note: **
277
278 1. 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.
279 1. TO code: The analog input channels (CH1, CH2) are setup by writing H3300 to BFM #0 of the LX3V-4AD
280 1. The number of averaged samples for CH1 and CH2 is set to 4 by writing 4 to BFM #1 and #2 respectively.
281 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.
282 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.
283
284 **Using gain and offset in a program**
285
286 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.
287
288 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.
289
290 The following is an example of changing the offset value on input channel CH1 to 0V and the gain value to 2.5V.
291
292 The LX3V-4AD block is in the position of block No.0 (i.e. closest to the LX3V main unit).
293
294 Example: Adjusting gain/offset via software settings
295
296 (% style="text-align:center" %)
297 [[image:LX3V-4AD_html_41bef52ee180f2c9.png||height="980" width="600" class="img-thumbnail"]]
298
299 (((
300 Adjustment start
301
302 * (H0000)->BFM#0 (initialize input channels). Enter the instructions on the left and RUN the PC
303 * (K1)->BFM#21. BFM#21 must be set to permit with (b1, b0)=(0,1)
304 * (K0)->BFM#22 (offset/gain adjusts). Reset adjust bits
305 * (K0)-> BFM#23 (offset)
306 * (K2500)-> BFM#24 (gain)
307 * (H0003)->BFM#22(offset/gain adjusts). 3=0011 i.e. O1=1, G1=1. Therefore channel 1 is adjusted.
308
309 Adjustment ends.
310
311 (K2)-> BFM#21. BFM#21 gain/offset adjust prohibit
312 )))
313
314 = **7 Diagnostics** =
315
316 **Preliminary checks**
317
318 1. Check whether the input wiring and/or extension cables are properly connected on LX3V-4AD analog special function block.
319 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.
320 1. Ensure that the correct operating range has been selected for the application.
321 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.
322 1. Put the LX3V main unit into RUN.
323
324 **Error checking**
325
326 If the LX3V-4AD special function block does not seem to operate normally, check the following items.
327
328 Check the status of the POWER LED.
329
330 Lit: The extension cable is properly connected.
331
332 Otherwise: Check the connection of the extension cable.
333
334 * Check the external wiring.
335 * Check the status of the “24V” LED (top right corner of the LX3V-4AD).
336
337 Lit: LX3V-4AD is OK; 24V DC power source is OK.
338
339 Otherwise: Possible 24VDC power failure, if OK possible LX3V-4AD failure.
340
341 * Check the status of the “A/D” LED (top right corner of the LX3V-4AD).
342
343 Lit: A/D conversion is proceeding normally.
344
345 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.