Type conversion

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Type conversion

mapp Services V5.16

The interpreter supports standard conversion functions as well as simplified built-in conversion functions.

conversion_principal

Syntax

*_TO_**(<Input>)

Standard conversion functions

TO_**(<Input>)

Simplified built-in conversion functions

Description

Asterisks represent data type names.

* Data type of the input parameter

Data type of the function value

Supported data types

•BOOL

Note: TO_BOOL from STRING or WSTRING returns TRUE for "1" and "TRUE"

•USINT

•SINT

•UINT

•INT

•UDINT

•DINT

•REAL

•LREAL

•BYTE

•WORD

•DWORD

•DATE

•TIME

•DATE_AND_TIME / DT

•TIME_OF_DAY / TOD

•STRING

•WSTRING

Example

Converting LREAL to STRING

VAR
    Value : LREAL := 1.0;
    Text : STRING[32];
END_VAR
PROGRAM _MAIN
    Text := TO_STRING(Value);
END_PROGRAM