STRING_TO_UINT_STEPSAVER

STRING (decimal format right-justified) into unsigned INTEGER

STRING_TO_UINT_STEPSAVER converts a right-justifed decimal number in a string into a value of the data type Unsigned INTEGER.

Parameters

Input

Unnamed input (STRING)

Input data type

Output

Unnamed output (UINT)

Conversion result

Remarks

The basic instruction F76_A2BIN with approx. 7 steps is used. The PLC issues an operation error especially if anything other than acceptable characters are used (see the following table "Acceptable characters").

Acceptable Format: '[Space][Sign][Decimal number]', e.g. '123456'

Acceptable characters:

  • Space

    Space “

  • Sign

    "+“ (plus), "-" (minus)

  • Decimal Number

    Decimal numbers "0“ - "9“

Example

POU header

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]:='123';
	END_VAR

LD body

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,STRING_TO_UINT_STEPSAVER!,Instance,15,2,30,4,,?D?C);
B(B_VARIN,,STRING_value,13,2,15,4,);
B(B_VAROUT,,UINT_value,30,2,32,4,);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

UINT_value:=  STRING_TO_UINT_STEPSAVER(STRING_value);

Modified on: 2019-01-24Feedback on this pagePanasonic hotline