8-digit BCD division, destination can be specified
The result is stored in the area specified by d, and the remainder is stored in the system variable sys_diDDivRemainder.
Input
Dividend, 32-bit area for BCD data or 8-digit BCD equivalent constant
Divisor, 32-bit area for BCD data or 8-digit BCD equivalent constant
Output
Quotient, 32-bit area for BCD data (remainder stored in the system variable sys_diDDivRemainder
Instead of using this F instruction, we recommend using the corresponding FP7 instruction:
FP_MOD_BCD,FP_DIV_MOD_BCD,FP_DIV_BCDif the calculated result is 0.
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
start: BOOL:=FALSE;
(*activates the fuction*)
dividend: DWORD:=16#00001110;
(*dividend*)
divisor: DWORD:=16#00000011;
(*divisor*)
output_value: DWORD:=0;
(*result after 0->1 leading edge
from start: 16#00000100*)
END_VAR
When the variable start 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 := 6 ;
NETWORK_BODY
B(B_CONTACT,,start,10,1,12,3,);
B(B_VARIN,,dividend,12,2,14,4,);
B(B_VARIN,,divisor,12,3,14,5,);
B(B_VAROUT,,output_value,21,2,23,4,);
B(B_F,F53_DBDIV!,Instance,14,0,21,5,,?DEN?D@'s1'?Ds2?AENO?Cd);
L(1,2,10,2);
L(12,2,14,2);
L(1,0,1,6);
END_NETWORK_BODY
END_NET_WORK
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 6 ;
NETWORK_BODY
L(1,0,1,6);
END_NETWORK_BODY
END_NET_WORK
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 6 ;
NETWORK_BODY
L(1,0,1,6);
END_NETWORK_BODY
END_NET_WORK
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 6 ;
NETWORK_BODY
L(1,0,1,6);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF start then
F53_DBDIV(dividend, divisor, output_value);
END_IF;