Skip to main content

7.10.1 SYS.CONVERT

Function

Data type conversion converts the data input in IN to the target data type and outputs it in OUT

LD graphics

alt text

Parameter description

Interface variableDeclarationData typeDescription
INVar_InputSource basic data typeData to be converted
Function nameReturn valueTarget basic data typeOutput the converted result
warning
  • When using this instruction, it is recommended to specify the source data type and target data type
  • In LD, select the source data type by clicking the "???" in the upper left corner of the graph; click the "???" in the upper right corner of the graph to select the target data type
  • When adding by dragging in ST, the data type selection window as shown below will appear:
  • alt text

Example

  • LD example is shown in the following animation:

alt text

  • ST example is shown in the following code:
OUT_DINT := UDINT_TO_DINT(IN_UDINT);