EasyManuals Logo

Mitsubishi MELSEC System Q User Manual

Mitsubishi MELSEC System Q
170 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #162 background imageLoading...
Page #162 background image
6.4.4 Division
The DIV instruction divides one number by another
Dividend
Divisor
Quotient (result of the division, dividend ÷ divisor = quotient)
In the above example the contents of data register D1 is divided by the contents of D2. The
result is stored in D3.
NOTE The divisor should never be 0. Division by 0 is not possible and will generate an error which
stops the PLC CPU. (This case is possible when, as shown in the above example, the divi
-
sion is performed with the contents of data registers and these registers have been cleared
with a RESET operation. To avoid a stop of the PLC the data register containing the divísor
should be set to an defined value by the PLC program before execution of the DIV instruc-
tion.)
The data types of the input and output variable of the DIV instruction must be identical. When
integer values (INT or DINT) are devided, the quotient will be also an integer value. To deter-
mine the remainder of the calculation the MOD instruction can be used.
The input variables of the MOD instruction are the same as for the DIV instruction. In the above
example the contents of data register D1 is divided by the contents of D2. The quotient is
stored in D3 and the remainder in D4:
The signs of the values are taken into account by the DIV instruction.In this example the coun
-
ter value of C0 is divided by the value in D10:
6–30 MITSUBISHI ELECTRIC
Math Instructions More Advanced Programming
Ladder Diagram
IEC Instruction List
LD D1
DIV D2
ST D3
IEC Instruction List
LD D1
DIV D2
ST D3
LD D1
MOD D2
ST D4
Ladder Diagram
40
6
D 1
D2
D3
6
D 4
4
Quotient (6 x 6 = 36) (Output of the DIV instruction)
Remainder (40 - 36 = 4) (Output of MOD instruction)
36
-5
C 0
D 10
D 200
-7

Table of Contents

Other manuals for Mitsubishi MELSEC System Q

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Mitsubishi MELSEC System Q and is the answer not in the manual?

Mitsubishi MELSEC System Q Specifications

General IconGeneral
BrandMitsubishi
ModelMELSEC System Q
CategoryController
LanguageEnglish

Related product manuals