TO_LITTLE_ENDIAN block

Short summary

Name

TO_LITTLE_ENDIAN

→POU type

→function

Category

IEC-block, Convert

Conform to →IEC-standard

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/error.svg currently restricted
(IEC additionally demands the WCHAR, array and structure data types for the input and the return value. Currently, these data types are not supported for the block.)

and

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/add.svg more possible than defined in IEC-standard
(IEC demands ANY_INT , ANY_BIT, ANY_REAL, WCHAR, TIME, array and structure data types for the input and the return value . Hence, IEC does not demand the data types DATE_AND_TIME, TIME_OF_DAY and DATE, but they are supported in logi.CAD 3.)

Graphical interface

images/download/thumbnails/414781118/TO_LITTLE_ENDIAN-version-1-modificationdate-1534929817540-api-v2.png

Available since

version 1.35.0 (for logi.CAD 3)

Functionality

The block converts a value (entered at input IN and existing in the appropriate →endian format of the target system) into the little-endian format .

Special case: The conversion result for the data types TIME, DATE, TIME_OF_DAY and DATE_AND_TIME depends on the timer frequency of the target system

(see under "Properties and restrictions specific to the target system")
. Therefore, different values might be returned on different target systems.

Inputs, return value


Identifier

→Data type

Description

Inputs:

IN

REAL, LREAL, USINT, UINT, UDINT, ULINT, SINT, INT, DINT, LINT, TIME, BOOL, BYTE, WORD, DWORD, LWORD, DATE_AND_TIME, DATE or TIME_OF_DAY

input value

Return value:

REAL, LREAL, USINT, UINT, UDINT, ULINT, SINT, INT, DINT, LINT, TIME, BOOL, BYTE, WORD, DWORD, LWORD, DATE_AND_TIME, DATE or TIME_OF_DAY


Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

Example for usage within ST-editor

PROGRAM Test
VAR
result1: INT;
result2: DINT;
result3: LWORD;
END_VAR
result1 := TO_LITTLE_ENDIAN(IN := INT#16#1234); (* The variable 'result1' evaluates to 'INT#16#1234' (decimal: 4_660). *)
result2 := TO_LITTLE_ENDIAN(IN := DINT#16#12345678); (* The variable 'result2' evaluates to 'DINT#16#12345678' (decimal: 305_419_896). *)
result3 := TO_LITTLE_ENDIAN(IN := LWORD#16#1234567890ABCDEF); (* The variable 'result3' evaluates to 'LWORD#16#1234567890ABCDEF' (decimal: 1_311_768_467_294_899_695). *)
END_PROGRAM

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.