IDEC SmartAXIS FT9Z-1A01 User Manual page 330

Table of Contents

Advertisement

13: S
CR I P TS
3. Logical Operators
Example 3.1
Logical AND
Script
if (([D0100] == [D0200]) && ([D0300] == [D0400] + [D0500]))
{
[D0600] = 100;
}
Operation Description
If the value of D0100 is equal to the value of D0200, and if the value of D0300 is equal to the value of D0400 and D0500 added
together, then 100 is stored in D0600.
If either ([D0100] == [D0200]) or ([D0300] == [D0400] + [D0500]) is false, the processing in the brackets "{ }" is not executed.
Example 3.2
Logical OR
Script
if ((0 != [D0100]) || (0 != [D0200]))
{
[D0300] = 100;
}
Operation Description
If the value of D0100 is not 0 or the value of D0102 is not 0, then 100 is stored in D0300.
If either one of them is true, the processing in the brackets "{ }" is executed.
Example 3.3
Logical inversion
Script
if (!([D0100] == 0x1234))
{
[D0300] = 100;
}
Operation Description
If the value of D0100 is not equal to 0x1234, then 100 is stored in D0300.
Example 3.4
Logical inversion
Script
if (!(0 !=[D0100]))
{
[D0300] = 100 ;
}
Operation Description
If the value of D0100 is 0, then 100 is stored in D0300.
This is the same as the code "if (0==[D0100]))".
13-22
S
A XI S P
/ L
U
'
M AR T
R O
I TE
SER
S
M
FT9Y-B 1378
ANUAL

Advertisement

Table of Contents
loading

Table of Contents