Flexible NC programming
1.9 Possible type conversions
Job planning
Programming Manual, 03/2006 Edition, 6FC5398-2BP10-1BA0
1-25
1.9 1.9 Possible type conversions
Function
Type conversion on assignment
The constant numeric value, the variable, or the expression assigned to a variable must be
compatible with the variable type. If this is this case, the type is automatically converted
when the value is assigned.
Possible type conversions
to REAL INT BOOL CHAR STRING AXIS FRAME
from
REAL yes yes* Yes
1
) yes* – – –
INT yes yes Yes
1
) Yes
2)
– – –
BOOL yes yes yes yes yes – –
CHAR yes yes Yes
1)
yes yes – –
STRING – – Yes
4)
Yes
3)
yes – –
AXIS – – – – – yes –
FRAME – – – – – – yes
Explanation
* At type conversion from REAL to INT, fractional values that are >=0.5 are rounded
up, others are rounded down (cf. ROUND function).
1)
Value <> 0 is equivalent to TRUE; value == 0 is equivalent to FALSE
2)
If the value is in the permissible range
3)
If only 1 character
4)
String length 0 = >FALSE, otherwise TRUE
Note
If conversion produces a value greater than the target range, an error message is output.
If mixed types occur in an expression, type conversion is automatic. Type conversions are
also possible in synchronous actions, see Chapter "Motion-synchronous actions, implicit type
conversion".