STRING (decimal format) into unsigned INTEGER
STRING_TO_UINT converts a string in decimal formal into a value of the data type Unsigned INTEGER.
First, the string is converted into a value of the data type STRING[32], which is subsequently converted into a value of the data type UINT in a subprogram with approximately 270 steps. The subprogram is also used by the functions STRING_TO_INT, STRING_TO_WORD, STRING_TO_UDINT and STRING_TO_DWORD.
Input
Input data type
Output
Conversion result
Acceptable Format:
'[Space][Sign][Decimal number][Space]', e.g. ' 123456 '
Acceptable characters:
Space
Space ““
Sign
"+“ (plus), "-" (minus)
Decimal Number
Decimal numbers "0“ - "9“
The analysis ends with the first non-decimal number.
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:=0;
STRING_value: STRING[8]:='543';
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_VARIN,,STRING_value,13,2,15,4,);
B(B_VAROUT,,UINT_value,24,2,26,4,);
B(B_F,STRING_TO_UINT!,Instance,15,2,24,4,,?D?C);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
UINT_value:= STRING_TO_UINT(STRING_value);