 FP_DIV_BCD
FP_DIV_BCDBCD data division
This FP instruction divides the BCD data specified by s1 by s2 if the trigger EN is TRUE. The result is stored in d.

Input
Dividend
Divisor
Output
Quotient

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
		bStart: BOOL:=FALSE;
			(*activates the fuction*)
		dwDividend: DWORD:=16#442200;
			(*dividend*)
		dwDivisor: DWORD:=16#2;
			(*divisor*)
		dwResult: DWORD:=0;
			(*result after a 0->1 leading
edge from start: 16#221100*)
	END_VAR
When the variable bStart is set to TRUE, the function is carried out.

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 7 ;
        NETWORK_BODY
B(B_F,FP_DIV_BCD!,,9,1,16,6,,?DEN?D@'s1'?Ds2?AENO?Cd);
B(B_CONTACT,,bStart,4,2,6,4,);
B(B_VARIN,,dwDividend,7,3,9,5,);
B(B_VARIN,,dwDivisor,7,4,9,6,);
B(B_VAROUT,,dwResult,16,3,18,5,);
L(6,3,9,3);
L(1,3,4,3);
L(1,0,1,7);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY
IF (bStart) then
    FP_DIV_BCD(s1 := dwDividend, s2 := dwDivisor, d => dwResult);
END_IF;