DINT_TO_BCD_DWORD

DOUBLE INTEGER into BCD DOUBLE WORD

DINT_TO_BCD_DWORD converts a value of the data type DINT into a BCD value of the data type DWORD.

Parameters

Input

Unnamed input (DINT)
Input data type

Output

Unnamed output (BCD_DWORD)
Conversion result

Remarks

The value for the input variable should be between 0 and 999,999,999.

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
		DINT_value: DINT:=0;
		BCD_value_32bit: DWORD:=0;
	END_VAR

This example uses variables. You can also use a constant for the input variable.

POU body

DINT_value of the data type DOUBLE INTEGER is converted into a BCD value of the data type DOUBLE WORD. The converted value is written to BCD_value_32bit.

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,,DINT_value,8,1,10,3,);
B(B_VAROUT,,BCD_value_32bit,22,1,24,3,);
B(B_F,DINT_TO_BCD_DWORD!,Instance,10,1,22,3,,?D?C);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

BCD_value_32bit:=DINT_TO_BCD_DWORD(DINT_value);

IL body

LD

DINT_value

DINT_TO_BCD_DWORD

ST

BCD_value_32bit

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