UINT_TO_BCD_WORD

Unsigned INTEGER into BCD value of WORD

UINT_TO_BCD_WORD converts a value of the data type Unsigned INTEGER into a BCD value of the data type WORD.

Parameters

Input

Unnamed input (UINT)
Input data type

Output

Unnamed output (BCD_WORD)
Conversion result

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:=1270;
		BCD_value_16bit: WORD:=16#0000;
	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_VARIN,,UINT_value,13,2,15,4,);
B(B_VAROUT,,BCD_value_16bit,26,2,28,4,);
B(B_F,UINT_TO_BCD_WORD!,Instance,15,2,26,4,,?D?C);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

BCD_value_16bit:=UINT_TO_BCD_WORD(UINT_value);

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