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

Page 1067

Advertising
background image

L-force | PLC Designer

Programming Reference

DMS 4.1 EN 03/2011 TD29

1065

BOOL_TO Conversions
IEC Operator: Converting from type BOOL to any other type.
Syntax for a BOOL_TO conversion operator:
BOOL_TO_<data 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', when the operand is TRUE or ‚FALSE' when the
operand is FALSE.
Examples in IL:

(* Result is 1 *)

(* Result is 'TRUE' *)

(* Result is T#1ms *)

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

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

(* 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