Wiki source code of 02 Devices

Last modified by Mora Zhou on 2023/11/22 14:13

Hide last authors
Stone Wu 13.1 1 = Device list =
Leo Wei 1.1 2
Stone Wu 13.1 3 |=(% scope="row" %)**Classification**|=**Type**|=**Device name**|=**Sign**|=**Range**|=**Number**
4 |=(% rowspan="10" %)User devices|Bit|Input|X|0 to 1777|Octal number
5 |(% scope="row" %)Bit|Output|Y|0 to 1777|Octal number
6 |(% scope="row" %)Bit|Internal relay|M|0 to 7999|Decimal number
7 |(% scope="row" %)Bit|Step relay|S|0 to 4095|Decimal number
8 |(% scope="row" %)Bit/word|Timer|T|0 to 511|Decimal number
9 |(% scope="row" %)Bit/word|Counter|C|0 to 255|Decimal number
10 |(% scope="row" %)Bit/double word|Long counter|LC|0 to 255|Decimal number
11 |(% scope="row" %)Bit/double word|High-speed counter|HSC|0 to 15|Decimal number
12 |(% scope="row" %)Word|Data Register|D|0 to 7999|Decimal number
13 |(% scope="row" %)Word|Data Register|R|0 to 29999|Decimal number
14 |=(% rowspan="2" %)System devices|Bit|Special|SM|0 to 4095|Decimal number
15 |(% scope="row" %)Word|Special register|SD|0 to 4095|Decimal number
16 |=(% rowspan="3" %)Index registers|Word|Index register|[D]|0 to 7999|Decimal number
17 |(% scope="row" %)Word|Index register|V|0 to 7|Decimal number
18 |(% scope="row" %)Double word|Long index register|Z|0 to 7|Decimal number
19 |=Nested|Bit|Nested|N|0 to 7|Decimal number
20 |=Pointer|-|Pointer|P|0 to 4095|Decimal number
21 |=(% rowspan="3" %)Constant|-|Decimal constant|K|-|Decimal number
22 |(% scope="row" %)-|Hexadecimal constant|H|-|Hexadecimal number
23 |(% scope="row" %)Single precision floating point|Real constant|E|-|-
Leo Wei 4.1 24
25 = User registers =
Leo Wei 1.1 26
Leo Wei 4.1 27 == Input relay (X) ==
Leo Wei 1.1 28
29 The input relay represents the original PLC external input signal status, and the external signal status is detected through the input X port. 0 represents the external signal is open, and 1 represents the external signal is closed.
30
31 Using the program instruction method, the state of the input relay cannot be modified, and its node signals (normally open, normally closed) can be used indefinitely in the user program.
32
33 The relay signal is identified by Signs such as X0, X1,......X7, X10, X11...... and its serial number is numbered in octal.
34
35 When an expansion module is connected, the extended X point will also use the X point as the component of the input signal state, and the occupied X point is the starting position of the X point used by the PLC with 0 as the end of the X point, such as PLC Occupy 17 to 24 X points (X0 to X21, X0 to X27), at this time the X points of the expansion module will be stored starting from X30.
36
Leo Wei 4.1 37 == Output relay (Y) ==
Leo Wei 1.1 38
39 The output relay is a Devices directly connected to the hardware port of the external user control device, and logically corresponds to the physical output port of the PLC. After the PLC scans the user program each time, the component status of the Y relay will be transmitted to the hardware port of the PLC. 0 means the output port is open; 1 means the output port is closed.
40
41 Y relay numbers are identified by Signs such as Y0, Y1,...Y7, Y10, Y11, etc., and their serial numbers are numbered in octal format. Y relay components can be used indefinitely as promised by users .
42
43 In terms of hardware, according to the different output components, it can be divided into relay type, transistor type, solid state relay type, etc. If there are output expansion module ports, they are numbered in sequence starting from the main module.
44
Leo Wei 4.1 45 == Internal relay (M) ==
Leo Wei 1.1 46
47 The auxiliary relay M element is used as an intermediate variable in the execution of the user program, just like the auxiliary relay in the actual electronic control system, used for the transmission of status information, and multiple M variables can also be combined into word variables. M variables and external ports There is no direct connection, but you can copy X to M through program statements, or copy M to Y to connect with the outside world. An M variable can be used unlimited times.
48
49 The auxiliary relay M is identified by Signs such as M0, M1........., M7999, and its serial number is numbered in decimal system.
50
Leo Wei 4.1 51 == Status relay (S) ==
Leo Wei 1.1 52
53 The state relay S is used for the design and execution of the step program. The STL step instruction is used to control the transfer of the step state S, simplifying the programming design. If STL programming is not used, S can be used as an M variable. State S variables are identified by Signs such as S0, S1...S4095, and their serial numbers are numbered in decimal system.
54
Leo Wei 4.1 55 == Timer (T) ==
Leo Wei 1.1 56
57 The timer T is equivalent to the time relay in the relay system and is used to complete the timing function. The timer is an addition expression. When the timer expires, the current value and the set value are the same value.
58
59 The measurement starts when the timer coil turns ON. When the current value of the timer is consistent with the set value, it will become the time limit, and the timer contact will turn ON. When the timer coil is turned OFF, the current value will become 0, and the timer contact will also become OFF.
60
61 The T value range of the timer is 0 to 32767.
62
63 When the timer coil (OUT T instruction) is executed, the timer coil is turned on/off, the current value is updated, and the contact is turned on/off.
64
Leo Wei 4.1 65 |=Registers|=Timer
66 |=T0 to T191|100ms timer
67 |=T192 to T199|100ms subroutine timer (used in the subroutine, even if the subroutine is not called, it will still be updated)
68 |=T200 to T245|10ms timer
69 |=T246 to T249|1ms accumulative timer
70 |=T250 to T255|10ms cumulative timer
71 |=T256 to T383|1ms timer
72 |=T384 to T511|0.1ms timer
Leo Wei 1.1 73
Stone Wu 15.1 74 **General-purpose timer (T0 to T245)**
Leo Wei 4.1 75
Leo Wei 1.1 76 (% style="text-align:center" %)
Stone Wu 15.1 77 [[image:02(1)_html_b1b48247f79e373c.gif||height="165" width="598" class="img-thumbnail"]]
Leo Wei 1.1 78
Stone Wu 15.1 79 As shown in the figure above: when the normally open contact of X0 is turned on, the current value counter of T200 starts timing from zero and counts up the 10ms clock pulse.
Leo Wei 1.1 80
Stone Wu 15.1 81 When the current value is equal to the set value 223, the timer's normally open contact is turned on and the normally closed contact is turned off, that is, the output contact of T200 will act after its coil is driven for 2.23s. After the normally open contact of X0 is disconnected, T200 is reset because the coil is de-energized. After reset, its normally open contact is disconnected, and the normally closed contact is connected, and the current value returns to zero.
Leo Wei 1.1 82
Stone Wu 15.1 83 **Accumulative timer (T246 to T255)**
84
Leo Wei 1.1 85 (% style="text-align:center" %)
Stone Wu 15.1 86 [[image:02(1)_html_ad4dcbfaa1b0c0af.gif||height="228" width="598" class="img-thumbnail"]]
Leo Wei 1.1 87
Stone Wu 15.1 88 * When the X1 normally open contact in Figure b is turned on, the current value counter of T250 accumulates the 10ms clock pulse.
89 * When the normally open contact of X1 is disconnected or stopped, the counting stops, and the current value remains unchanged.
90 * When the normally open contact of X1 is turned on again, counting continues.
91 * When the accumulated time t1+t2 is 4.2s, the current value is equal to the set value of 420, the normally open contact of T250 is turned on and the normally closed contact is turned off.
92 * When the normally open contact of X2 is turned on, T250 will reset (because the coil of the accumulative timer will not reset when the power is off, you need to use the normally open contact of X2 and the reset instruction to force T250 to reset).
Leo Wei 1.1 93
Stone Wu 15.1 94 **Setting value**
Leo Wei 1.1 95
96 The timer time can use the constants (K, H) in the program memory as the set value, or can be specified indirectly by the content of the data register (D).
97
98 (% style="text-align:center" %)
Leo Wei 1.2 99 [[image:02(1)_html_dcbc4c6a61066b8e.png||height="128" width="300" class="img-thumbnail"]]
Leo Wei 1.1 100
101 After PLC is powered on, multiplication is performed, D3=D0*2. Use the data of D3 as the timing time value of T10.
102
Leo Wei 4.1 103 == Counter (C) ==
Leo Wei 1.1 104
Stone Wu 15.1 105 The counter is used to complete the counting function. Each counter contains a coil, a contact, and a timer value register. Whenever the driving signal of the counter coil changes from OFF to ON, the counter reading value increases by 1.
Leo Wei 1.1 106
Stone Wu 15.1 107 If the timer value reaches the preset time value, its contact action, a contact (NO contact) is closed, b contact (NC contact) is opened;
108
109 If the timing value is cleared, the output a contact will be opened, and b contact (NC contact) will be closed. Some timers have features such as power-down retention, accumulation, etc., and maintain the value before power-down after power-on again.
110
Leo Wei 1.1 111 The counters are identified by C0, C1,..., C255, and the order is numbered in decimal.
112
113 The counter (C) is a 16-bit counter.
114
115 (% style="text-align:center" %)
Stone Wu 15.1 116 [[image:02(1)_html_740e6ef971b9c6de.gif||height="175" width="598" class="img-thumbnail"]]
Leo Wei 1.1 117
Mora Zhou 25.1 118 The setting value of the 16-bit up counter is 1 to 32767. As shown in the working process of the up counter in Figure C, after the normally open contact of X1 in the figure is turned on, C0 is reset, its corresponding bit storage unit is set to 0, the normally open contact of C0 is disconnected, and the normally closed contact point is turned on, and its current counter value is set to 0 at the same time.
Leo Wei 1.1 119
Stone Wu 15.1 120 X2 provides a counting input signal. When the reset input circuit of the counter is disconnected and the counting input circuit changes from disconnected to connected (that is, the rising edge of the counting pulse), the current value of counter C0 is increased by 1. After 10 count pulses, the current value of C0 is equal to the set value of 10, and its corresponding bit storage unit is set to 1, and the Y0 contact is turned on at this time. When counting pulses again, the current value does not change until the reset input signal is turned on, and the current value of the counter is set to 0.
Leo Wei 1.1 121
Stone Wu 15.1 122 == Long counter (LC) ==
123
Leo Wei 1.1 124 The long counter (LC) is basically the same as the counter (C), but compared to the counter (C), the long counter (LC) is a 32-bit register, and the range of values that can be counted is larger.
125
126 The long counter is identified by LC0, LC1,...,LC255, and the sequence is numbered in decimal.
127
Leo Wei 4.1 128 == High-speed counter (HSC) ==
Leo Wei 1.1 129
Stone Wu 15.1 130 High-speed counter (HSC) is a device used for counting through external input of high-speed pulse signals. HSC is a 32-bit register.
Leo Wei 1.1 131
132 The corresponding parameter configuration can be configured through: “project management” -> “parameters” -> “high-speed counter configuration”:
133
134 (% style="text-align:center" %)
Leo Wei 1.2 135 [[image:02(1)_html_d2ac1dfce0424263.png||height="198" width="300" class="img-thumbnail"]]
Leo Wei 1.1 136
137 (% style="text-align:center" %)
138 [[image:02(1)_html_a2d0f82f3579adff.png||class="img-thumbnail"]]
139
Stone Wu 15.1 140 == Data register (D&R) ==
Leo Wei 1.1 141
142 Registers are used for data calculation and storage, such as the calculation and calculation of timers, counters, and analog parameters. The width of each register is 16 bits. If 32bit instructions are used, the adjacent registers are automatically formed into 32bit registers for use, the lower address is the low byte, and the higher address is the high byte.
143
Stone Wu 16.1 144 * The address range of D register: D0 to D7999;
145 * The address range of R register: R0 to R29999.
Leo Wei 1.1 146
147 The data involved in operations in most of our series PLC instructions are processed as signed numbers. For 16-bit registers, bit15 is the sign bit (0 represents a positive number, 1 represents a negative number); for a 32-bit register, the high byte bit15 It is the sign bit, and the value range is -32768 to 32767.
148
Stone Wu 15.1 149 When 32-bit data needs to be processed, the two adjacent D registers can be formed into a 32-bit double word. For example, when accessing D100 in 32-bit format, use the high address D101 register as the high word and the high byte bit 15 as The sign bit of a double word can handle values from -2147483648 to 2147483647.
Leo Wei 1.1 150
Leo Wei 4.1 151 = System device =
Leo Wei 1.1 152
Stone Wu 17.1 153 == Special relay (SM) ==
Leo Wei 1.1 154
155 The special relay SM is an internal relay with a certain specification inside the programmable controller, so it cannot be used in the program like ordinary internal relays. It can be turned ON/OFF as needed to control the PLC.
156
Stone Wu 17.1 157 For details, please refer to [[(% class="wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink" %)__Special relays (SM) list__>>path:https://docs.we-con.com.cn/bin/view/PLC%20Editor2/15/#HAppendix1SpecialRelay28SM29]](%%).
Leo Wei 1.1 158
Stone Wu 17.1 159 == Special register (SD) ==
Leo Wei 1.1 160
161 The special register SD is an internal register whose specifications are determined within the programmable controller, so it cannot be used in the program like a normal internal register, and the corresponding data can be written as needed to control the PLC.
162
Stone Wu 17.1 163 For details, please refer to [[(% class="wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink wikiinternallink" %)__Special register (SD) list__>>path:https://docs.we-con.com.cn/bin/view/PLC%20Editor2/15/#HAppendix2SpecialRegister28SD29]](%%).
Leo Wei 1.1 164
Stone Wu 17.1 165 = Index register =
Leo Wei 1.1 166
Leo Wei 4.1 167 == Index register ([D]) ==
Leo Wei 1.1 168
169 The index register is used to modify the index of the Devices. [D] The index register is actually the same as the data register D, ranging from D0 to D7999. The input method is as follows, just add [D] directly after the Devices:
170
171 (% style="text-align:center" %)
172 [[image:02(1)_html_a363303e0fb39bd.png||class="img-thumbnail"]]
173
174 The supported soft components for index modification are as follows:
175
Stone Wu 17.1 176 * Constant K, H plus index modification, such as D0 = 10, K10[D0] result = 10 + 10 = 20.
177 * Constant E and character strings do not support index modification.
178 * Add index modification to the data device, such as D0 = 10, the result of D10[D0] is the value of D20. Even if D10[D0] is used in a double word instruction, the double word value is the value of D20 (low word) and D21 (high word).
179 * Bit device plus index modification, such as D0 = 10, the result of M0[D0] is the value of M10.
180 * Bits are combined into words with index modification. For example, D0 = 10, K4M10[D0] first takes M10 offset by 10 addresses, and then combines them. The result is equivalent to K4M10.
Leo Wei 1.1 181
182 Whether the index modification can be used depends on whether each instruction supports the format, you can check the "offset modification" in the description of the available device for each instruction.
183
Leo Wei 4.1 184 = Nesting =
Leo Wei 1.1 185
Leo Wei 4.1 186 == Nesting (N) ==
Leo Wei 1.1 187
188 Nesting is a device used in master station control instructions (MC/MCR instructions)*1 to program operating conditions through a nested structure. Specify with a small number (order from N0 to N7) from the outside of the nested structure.
189
190 (% style="text-align:center" %)
191 [[image:02(1)_html_9f527858e72d3a79.gif||class="img-thumbnail"]]
192
193 *1 is an instruction used to create an efficient ladder switching program by opening and closing the common bus of the Circuit program.
194
Stone Wu 17.1 195 = Pointer =
Leo Wei 1.1 196
Leo Wei 4.1 197 == Pointer (P) ==
Leo Wei 1.1 198
199 The pointer is the device used in the jump instruction (CJ instruction).
200
201 At present, the CALL instruction directly uses the subroutine name to call, and no longer uses the P pointer.
202
Leo Wei 4.1 203 = Constant =
Leo Wei 1.1 204
205 The constants are explained below.
206
Leo Wei 4.1 207 == Decimal constant (K) ==
Leo Wei 1.1 208
Stone Wu 19.1 209 “K” is a Sign that represents a decimal integer and is specified by K£ (for example: K123). It is mainly used to designate the set value of a timer or counter or the value in the operand of an application instruction. In 16bit instructions, the value range of constant K is -32768 to 32767; in 32bit instructions, the value range of constant K is -2147483648 to 2147483647.
Leo Wei 1.1 210
Leo Wei 4.1 211 == Hexadecimal constant (H) ==
Leo Wei 1.1 212
213 “H” is the Sign of hexadecimal number, specified by H□ (example: H123), mainly used to designate the value of the operand of the application instruction. The value range of the constant H is 0000 to FFFF; in the 32-bit instruction, the value range of the constant K is 0000, 0000 to FFFF, FFFF.
214
Leo Wei 4.1 215 == Real number constant (E) ==
Leo Wei 1.1 216
217 “E” is the single-precision floating-point number representation Sign, specified by E□ (example: E1.23), mainly used to specify the value of the operand of the application instruction, the value range of the single-precision floating-point number E is ±1.175495*10 -38 to ±3.402823*10+38 (±1.175495 E-38 to ±3.402823 E+38) and 0 (7 effective digits).
218
219 (% style="text-align:center" %)
220 [[image:02(1)_html_8a090037e802011b.png||class="img-thumbnail"]]
221
Stone Wu 17.1 222 The address occupies D1 and D0.
Leo Wei 1.1 223
Leo Wei 4.1 224 == String constant ==
Leo Wei 1.1 225
Stone Wu 18.1 226 The character string constant is the device that specifies the character string, and only supports the ASCII code character set, and any character string ends with a NULL character (00H). To use string devices, you must use double quotation marks to modify the characters, as follows to convert the string to ASCII characters and fill in the device starting with D0:
Leo Wei 1.1 227
228 (% style="text-align:center" %)
229 [[image:02(1)_html_61bdd1807e91322f.png||class="img-thumbnail"]]
230
Leo Wei 4.1 231 = Power-down retention setting =
Leo Wei 1.1 232
Stone Wu 17.1 233 The user can freely configure the power-off storage range within the range of the Devices.
Leo Wei 1.1 234
Stone Wu 17.1 235 The constant configuration is located in: “Project Management”→”Parameters”→”PLC Parameters”→”Device Latch”.
236
Leo Wei 1.1 237 (% style="text-align:center" %)
238 [[image:02(1)_html_6ba62f454f76a539.png||class="img-thumbnail"]]
239
Stone Wu 17.1 240 (% class="box infomessage" %)
241 (((
Leo Wei 4.1 242 **✎Note: **The X and Y registers do not support the power-down save function.
Stone Wu 17.1 243 )))
Leo Wei 1.1 244
Leo Wei 4.1 245 = Special use of device =
Leo Wei 1.1 246
Stone Wu 17.1 247 **Use bits to form words**
Leo Wei 1.1 248
249 Format: KnB
250
Stone Wu 17.1 251 * K is a fixed character.
252 * The value of n is 1 to 8, which means that (n * 4) bits are combined into a word, such as K4M0 is a combination of M0 to M15.
253 * B is the bit device number.
Leo Wei 1.1 254
255 Example: Set a total of 32 bits M0 to M31 at the same time.
256
257 (% style="text-align:center" %)
258 [[image:02(1)_html_93f997406ac1572a.png||class="img-thumbnail"]]
259
Stone Wu 17.1 260 (% class="box infomessage" %)
261 (((
Leo Wei 1.1 262 **✎Note: **KnB type can also support index modification.
Stone Wu 17.1 263 )))
Leo Wei 1.1 264
Stone Wu 17.1 265 **Take the bit in the word**
Leo Wei 1.1 266
267 Format: D.b
268
Stone Wu 17.1 269 * D is the number of data device D (R is not available).
270 * b is the bit number that needs to be taken, hexadecimal, and the value range is 0 to F.
Leo Wei 1.1 271
272 Example: bit14 in D2000 is set and Y0 is output
273
274 (% style="text-align:center" %)
275 [[image:02(1)_html_8908a96754754a6.png||class="img-thumbnail"]]
276
Stone Wu 17.1 277 (% class="box infomessage" %)
278 (((
Leo Wei 1.1 279 **✎Note: **D.b type can also support index modification.
Stone Wu 17.1 280 )))