TO_LITTLE_ENDIAN block
Short summary
Name |
TO_LITTLE_ENDIAN |
→POU type |
|
Category |
|
Conform to →IEC-standard |
currently restricted and
more possible than defined in IEC-standard |
Graphical interface |
|
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 |
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.