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 |
---|---|
1 | |
'TRUE' | |
T#1ms | |
TOD#00:00:00.001 | |
D#1970-01-01 | |
DT#1970-01-01-00:00:01 |
Siehe auch:
- Datentypen > BOOL