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

Page 488

Advertising
background image

L-force | PLC Designer

IEC Operators and additional norm extending functions

486

DMS 3.2 EN 02/2011 TD29



9.9.2

BOOL_TO Conversions

Conversion from type BOOL to any other type:

For number types the result is 1, when the operand is TRUE, and 0, when the operand
is FALSE.

For the STRING type the result is ‚TRUE' or ‚FALSE'.

Examples in IL:

LD TRUE
BOOL_TO_INT
ST i

(*Result is 1 *)

LD TRUE
BOOL_TO_STRING
ST str

(*Result is 'TRUE' *)

LD TRUE
BOOL_TO_TIME
ST t

(*Result is T#1ms *)

LD TRUE
BOOL_TO_TOD
ST

(*Result is TOD#00:00:00.001 *)

LD FALSE
BOOL_TO_DATE
ST dat

(*Result is D#1970-01-01 *)

LD TRUE
BOOL_TO_DT
ST dandt

(*Result is DT#1970-01-01-
00:00:01 *)


Examples in ST:

i:=BOOL_TO_INT(TRUE);

(* Result is 1 *)

str:=BOOL_TO_STRING(TRUE);

(* Result is "TRUE" *)

t:=BOOL_TO_TIME(TRUE);

(* Result is T#1ms *)

tof:=BOOL_TO_TOD(TRUE);

(* Result is TOD#00:00:00.001*)

dat:=BOOL_TO_DATE(FALSE);

(* Result is D#1970 *)

dandt:=BOOL_TO_DT(TRUE);

(* Result is DT#1970-01-01-
00:00:01 *)

Advertising