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 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:
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|
![]() |
|