EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers.

TO_BOOL Conversions

Definition

IEC operator for conversions from another variable type to BOOL.

Syntax

<data type>_TO_BOOL

Conversion Results

The result is TRUE when the operand is not equal to 0. The result is FALSE when the operand is equal to 0.

The result is TRUE for STRING type variables when the operand is TRUE. Otherwise the result is FALSE.

Examples in ST

Examples in ST with conversion results:

Example

Result

b := BYTE_TO_BOOL(2#11010101);

TRUE

b := INT_TO_BOOL(0);

FALSE

b := TIME_TO_BOOL(T#5ms);

TRUE

b := STRING_TO_BOOL('TRUE');

TRUE

Examples in IL

Examples in IL with conversion results:

Example

Result

LD                213
BYTE_TO_BOOL
ST                b

TRUE

LD                0
INT_TO_BOOL
ST                b

FALSE

LD                T#5ms
TIME_TO_BOOL
ST                b

TRUE

LD                'TRUE'
STRING_TO_BOOL
ST                b

TRUE

Examples in FBD

Examples in FBD with conversion results:

Example

Result

G-SE-0024438.1.gif-high.gif

 

 

TRUE

G-SE-0024439.1.gif-high.gif

 

 

FALSE

G-SE-0024440.1.gif-high.gif

 

 

TRUE

G-SE-0024437.1.gif-high.gif

 

 

TRUE