WORD_BCD_TO_INT

BCD value of WORD into INTEGER

WORD_BCD_TO_INT converts a binary coded BCD value of WORD into binary values of type INT.

Parameters

Input

Unnamed input (WORD_BCD)

Input data type

Output

Unnamed output (INT)

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
		BCD_value_16bit: WORD:=0;
		INT_value: INT:=0;
	END_VAR

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

BCD constants can be expressed in Control FPWIN Pro7 as follows: 2#0001100110010101 or 16#1995

POU body

BCD_value_16bit of the data type WORD is converted into an INTEGER value. The converted value is written into output variable INT_value.

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,,BCD_value_16bit,12,1,14,3,);
B(B_VAROUT,,INT_value,25,1,27,3,);
B(B_F,WORD_BCD_TO_INT!,Instance,14,1,25,3,,?D?C);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

INT_value:=WORD_BCD_TO_INT(BCD_value_16bit);

IL body

LD

BCD_value_16bit

WORD_BCD_TO_INT

ST

INT_value

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