8 Application Instructions API 100-149 Program Example 1: If M0 = On, the value in D0 (K103) will be divided by the value in D10 (K5) and the quotient will be stored in D20. On/Off of the highest bit indicates the positive/negative status of the result value. DIV16 D0 D10 D20 M0 DIV16 D0 D10 D20 M0 D0/D10=D20 K103/K5=K20. The remainder is K3. D20=K20 (The remainder is left out.) Program Example 2: If M0 = On, the value in (D1, D0) (K81,000) will be divided by the value in (D11, D10) (K40,000) and the quotient will be stored in (D21, D20). On/Off of the highest bit indicates the positive/negative status of the result value. M0 (D1,D0)/(D11,D10)=(D21,D20) K81,000/K40,000=K2.
The remainder is K1,000. (D21,D20)=K2 (The remainder is left out.) Remarks: 1. If users need to record a remainder by a 16-bit division, they have to use API23 DIV/DIVP. Please refer to the explanation of API23 DIV/DIVP for more information. 2. If users need to record a remainder by a 32-bit division, they have to use API23 DDIV/DDIVP. Please refer to the explanation of API23 DDIV/DDIVP for more information. DVP-PLC Application Manual 8-29 DIV32 D0 D10 D20