<< Click to Display Table of Contents >>
Memory Variables Tag |
Use a PLC or Block Tag for reading or writing Words (16-bit values) at the memory address specified by the N3/B3 parameter, according to the type of variable selected by the N1/B1 parameter.
For Data Module-type variables, with the N1/B1 parameter equal to 68, it is also necessary to indicate the DB Number using the N2/B2 parameter of the PLC or Block Tag.
Parameters for reading and writing Memory Variables
N1/B1 |
Type of variable. Possible values are 77 (4Dh): Merker (Word), 68 (44h): Data Module (Word), 100 (64h): Data Buffer (Word), or 67 (43h): Data Field (Word). NOTE: To read bits from a Word, add the value 256 to the value of the N1/B1 parameter |
N2/B2 |
DB Number, only for N1/B1 equal to 68 |
N3/B3 |
Variable memory address |
N4/B4 |
Bit number, only for N1/B1 + 256 |
To manipulate an individual position of a bit in a 16-bit register, add the value 256 to the type of variable defined by the N1/B1 parameter and specify the bit position via the N4/B4 parameter.
For example, to access the bit 5 (five) of a Merker variable, define the N1/B1 parameter with the value 77 + 256, that is, N1/B1 equal to 333 and specify the N4/B4 parameter with the value 5 (five) to determine the respective position of that bit.
The N4 parameter must be defined with values from 1 (one) to 16, according to the next table.
Register Word (16 bits) |
||||||||||||||||
Bit |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
N4 |
16 |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
When using Block Tags, each Element of a Block Tag represents the position of a Word bit, as shown on the next table.
Register Word (16 bits) |
||||||||||||||||
Bit |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Element |
16 |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
Users can also access bits from multiple Word values, by adding more Elements to a Block Tag, according to the next tables.
Register #2 Word (16 bits) |
||||||||||||||||
Bit |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Element |
32 |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
Register #1 Word (16 bits) |
||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Bit |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Element |
16 |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
If users want to access a group of bits in a Word value, they must use the B4 parameter as the start bit. In the example of the next table, the bits from 8 (eight) to 15 of a Word are accessed using a Block Tag with 8 (eight) Elements and its B4 parameter equal to 9 (nine).
Register Word (16 bits) |
||||||||||||||||
Bit |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Element |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
|
|
|
|
|
|
|
|
B4 |
16 |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
NOTE |
To write bits, use only PLC Tags, informing the bit position, from 1 (one) to 16, to write in the N4 parameter. |