Unsigned INTEGER into STRING
UINT_TO_STRING_LEADING_ZEROS converts a value of the data type Unsigned INTEGER into a value of the data type STRING.
Generates a result string in right-aligned decimal representation, filled with leading spaces up to the predefined maximum number of characters.Input
Input data type
Output
Conversion result
The result is not specified when the range of the input values does not match the range of the output values.
When using the data type STRING with small PLCs like FP-e or FP0, make sure that the length of the result string is equal to or greater than the length of the source string.
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
UINT_value: UINT:=49152;
STRING_value: STRING[8]:='';
END_VAR
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_F,UINT_TO_STRING_LEADING_ZEROS!,Instance,15,2,32,4,,?D?C);
B(B_VARIN,,UINT_value,13,2,15,4,);
B(B_VAROUT,,STRING_value,32,2,34,4,);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
STRING_value:= UINT_TO_STRING_LEADING_ZEROS(UINT_value);