100BBasic instructions
7.7 Convert
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05
201
7.7
Convert
7.7.1
CONV instruction
Table 7- 73 Convert (CONV) instruction
LAD / FBD
SCL
Description
out := <data type in>_TO_<data type out>(in);
Converts a data element from one
data type to another data type.
1
For LAD and FBD: Click the "???" and select the data types from the drop-down menu.
2
For SCL: Construct the conversion instruction by identifying the data type for the input parameter (in) and output
parameter (out). For example, DWORD_TO_REAL converts a DWord value to a Real value.
Table 7- 74 Data types for the parameters
Parameter
Data type
Description
IN
Bit string
1
, SInt, USInt, Int, UInt, DInt, UDInt, Real, LReal,
BCD16, BCD32
Input value
OUT
Bit string
1
, SInt, USInt, Int, UInt, DInt, UDInt, Real, LReal,
BCD16, BCE32
Input value converted to a new data type
1
The instruction does not allow you to select Bit strings (Byte, Word, DWord). To enter an operand of data type Byte,
Word, or DWord for a parameter of the instruction, select an unsigned integer with the same bit length. For example,
select USInt for a Byte, UInt for a Word, or UDInt for a DWord.
After you select the (convert from) data type, a list of possible conversions is shown in the
(convert to) dropdown list. Conversions from and to BCD16 are restricted to the Int data
type. Conversions from and to BCD32 are restricted to the DInt data type.
Table 7- 75 ENO status
ENO
Description
Result OUT
1
No error
Valid result
0
IN is +/- INF or +/- NaN
+/- INF or +/- NaN
0
Result exceeds valid range for OUT data type
OUT is set to the least-significant bytes of IN