BOOL_TO_<type>

Der IEC-Operator dient der Konvertierung vom Datentyp BOOL in einen anderen Datentyp.

Syntax: BOOL_TO_<Datentyp>

Bei Zahlendatentypen ist das Ergebnis 1, wenn der Operand TRUE ist, und 0, wenn der Operand FALSE ist. Beim Datentyp STRING ist das Ergebnis TRUE oder FALSE.

Beispiele:

ST-Code

Ergebnis

nVar := BOOL_TO_INT(TRUE);

1

sVar := BOOL_TO_STRING(TRUE);

'TRUE'

tVar := BOOL_TO_TIME(TRUE);

T#1ms

tVar := BOOL_TO_TOD(TRUE);

TOD#00:00:00.001

dVar := BOOL_TO_DATE(FALSE);

D#1970

dtVar := BOOL_TO_DT(TRUE);

DT#1970-01-01-00:00:01

FUP-Code

Ergebnis

BOOL_TO_<type> 1:

1

BOOL_TO_<type> 2:

'TRUE'

BOOL_TO_<type> 3:

T#1ms

BOOL_TO_<type> 4:

TOD#00:00:00.001

BOOL_TO_<type> 5:

D#1970-01-01

BOOL_TO_<type> 6:

DT#1970-01-01-00:00:01

Siehe auch: