IDEC SmartAXIS FT9Z-1A01 User Manual page 332

Table of Contents

Advertisement

13: S
CR I P TS
5. Bitwise Operators
Example 5.1
Logical AND
Script
if ([D0000.01] & [D0001.01])
{
SET([D0002.01)]);
}
else
{
RST([D0002.01]);
}
Operation Description
If the bitwise logical AND operation on the value of D0000.01 and the value of D0001.01 is 1, D0002.01 is changed to 1.
If the bitwise logical AND operation on the value of D0000.01 and the value of D0001.01 is 0, D0002.01 is changed to 0.
The operation is the same as the following ladder diagram.
D0000.01
D0001.01
Example 5.2
Logical OR
Script
if ([D0000.01] | [D0001.01])
{
SET([D0002.01]);
}
else
{
RST([D0002.01]);
}
Operation Description
If the bitwise logical OR operation on the value of D0000.01 and the value of D0001.01 is 1, D0002.01 is changed to 1.
If the bitwise logical OR operation on the value of D0000.01 and the value of D0001.01 is 0, D0002.01 is changed to 0.
The operation is the same as the following ladder diagram.
D0000.01
D0001.01
Example 5.3
Logical XOR (exclusive OR)
Script
[D0200] = [D0100] ^ 0xFF;
Operation Description
The logical XOR operation on the value of D0100 and each bit in 0xFF is stored in D0200.
For example, if the value of D0100 is 15 (0x0F), then 240 (0xF0) is stored in D0200.
Example 5.4
Inversion
Script
[D0200] = ~[D0100];
Operation Description
The bits in the value of D0100 are inverted and stored in D0200.
For example, if the value of D0100 is 0, then 65,535 is stored in D0200.
13-24
D0002.01
D0002.01
S
A XI S P
/ L
M AR T
R O
U
'
M
FT9Y-B 1378
I TE
SER
S
ANUAL

Advertisement

Table of Contents
loading

Table of Contents