Chapter 8 Logic Instructions
When the data types of input variables are not BOOL, TIME, DATE, TOD or STRING, the input
parameters In0~In1 are allowed to connect the variables of different data types.
When the data types of input variables are one of BOOL, TIME, DATE, TOD and STRING, all the
input variables and output variable should be of the data type. For example, if the data type of the
variable connected to In0 is TIME, the data types of the variables connected to In1 and Out must be
TIME. Otherwise, an error will occur during the compiling of the software.
Precautions for Correct Use
The input variables are not allowed to omit. An error will occur during the compiling of the software if
the input variables are omitted. But the output variable is allowed to omit.
The length of the data type of the output variable must contain the length of the variables that the
input parameters In0 and In1 connect. Otherwise, an error will occur during the compiling of the
software.
Programming Example
The data types of SEL_G, SEL_In0 and SEL_In1 are BOOL, UINT and DINT and the data type of
Out1 is DINT. When SEL_EN is TRUE, the value of Out1 is 50 if the values of SEL_G, SEL_In0 and
SEL_In1 are FALSE, 50 and 100 respectively as shown in the following table Variable 1. If the
values of SEL_G, SEL_In0 and SEL_In1 are TRUE, 50 and 100 respectively, the value of Out1 is
100 as shown in the following table Variable 2.
Variable 1
Out1 DINT 50
Variable 2
The program
In0 INT#10:
In1 INT#20:
SEL
Out:INT#10
G=FALSE
In0 INT#10:
In1 INT#20:
SEL
Out:INT#20
G=TRUE
1
SEL
EN ENO
G Out
In1
In0
SEL_EN
SEL_G
SEL_ In1
SEL_ In0
Out1
8-137