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:

(*Result is 1 *)
LD TRUE
BOOL_TO_INT
ST i

(*Result is 'TRUE' *)
LD TRUE
BOOL_TO_STRING
ST str

(*Result is T#1ms *)
LD TRUE
BOOL_TO_TIME
ST t

(*Result is TOD#00:00:00.001 *)
LD TRUE
BOOL_TO_TOD
ST

(*Result is D#1970-01-01 *)
LD FALSE
BOOL_TO_DATE
ST dat

(*Result is DT#1970-01-01-00:00:01 *)
LD TRUE
BOOL_TO_DT
ST dandt

Examples in ST:

(* Result is 1 *)
i:=BOOL_TO_INT(TRUE);

(* Result is "TRUE" *)
str:=BOOL_TO_STRING(TRUE);

(* Result is T#1ms *)
t:=BOOL_TO_TIME(TRUE);

(* Result is TOD#00:00:00.001 *)
tof:=BOOL_TO_TOD(TRUE);

(* Result is D#1970 *)
dat:=BOOL_TO_DATE(FALSE);

(* Result is DT#1970-01-01-00:00:01 *)
dandt:=BOOL_TO_DT(TRUE);

Examples in FBD:

../_images/aeba4aba555be7ce0a317d3108f08921 Result is 1
../_images/452ca3f9555c08390a317d31165b4814 Result is "TRUE"
../_images/473bbd1d555c2ae50a317d3172937330 Result is T#1ms
../_images/ceb1612a555c4b500a317d315f12728a Result is TOD#00:00:00.001
../_images/f6456b46555c68040a317d3123bb0c76 Result is D#1970-01-01
../_images/7ef56165555c89590a317d3115e3ff67 Result is                                                       DT#1970-01-01-00:00:01