To_bool conversions, L-force | plc designer – Lenze PLC Designer PLC Designer (R2-x) User Manual

Page 490

Advertising
background image

L-force | PLC Designer

IEC Operators and additional norm extending functions

488

DMS 3.2 EN 02/2011 TD29



9.9.3

TO_BOOL Conversions

Conversion from another variable type to BOOL:

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 IL:

LD 213
BYTE_TO_BOOL
ST b

(*Result is TRUE *)

LD 0
INT_TO_BOOL
ST b

(*Result is FALSE *)

LD T#5ms
TIME_TO_BOOL
ST b

(*Result is TRUE *)

LD 'TRUE'
STRING_TO_BOOL
ST b

(*Result is TRUE *)

Examples in FUP:

(*Result is TRUE *)

(*Result is FALSE *)

(*Result is TRUE *)

(*Result is TRUE *)

Examples in St:

b := BYTE_TO_BOOL(2#11010101);

(* Result is TRUE *)

b := INT_TO_BOOL(0);

(* Result is FALSE *)

b := TIME_TO_BOOL(T#5ms);

(* Result is TRUE *)

b := STRING_TO_BOOL('TRUE');

(* Result is TRUE *)

Advertising