Type_Cast - Siemens SINUMERIK 828D Commissioning Manual

Turning and milling, valid for cnc software version 4.5
Hide thumbs Also See for SINUMERIK 828D:
Table of Contents

Advertisement

8.7.30

TYPE_CAST

Description
Identifier to convert the data type of a local variable.
Programming
Identifier:
Syntax:
Attributes:
Example
<let name="v1" type="string" >1234.566</let>
<let name="result" type="double" />
...
<type_cast name="v1" type="double" />
<op> result = v1 *23.5 </op>
...
Special case:
If a PLC double word is to be processed as a floating-point number, an assignment to a local
variable is necessary. So that the binary value can be saved correctly, the format of the local
variables must be of the INTEGER type.
It is then converted to a floating-point number with the TYPE_CAST operation. In order to be
able to interpret the integer value as a floating-point number, use the convert attribute
instead of the type attribute. It interprets the bit combination of the integer value as a float
value and changes the format specification of the variables to float.
<let name="plc_float" />
<let name="result" type="float" />
...
...
<timer>
Turning and Milling
Commissioning Manual, 02/2012, 6FC5397-3DP40-3BA0
TYPE_CAST
<type_cast name="variable name" type=" new type" />
name
type
convert
<type_cast name="plc_float" type="int" />
<op> plc_float = "PLC/MD100"</op>
Name of variable
New data type
Interprets the bit combination (indirect assignment)
8.7 Description of the script language
Easy Extend
227

Advertisement

Table of Contents
loading

Table of Contents