Mitsubishi Electronics 13JW55 사용자 설명서
5 - 43
Project name
QB-19
Program name
MAIN
5.4.4 Calculation examples for multiplication and division including decimal points (when the multiplication
or division is used)
Example 1 Calculation example to determine a circumference
Digitalswitch value × 3.14
→ Integral part and Decimal part
• Programming
method
Handle the circular constant as 314 (3.14 × 100), and divide the result by 100
afterward.
Example 2 Calculation example to handle values after decimal point (division
example)
Digitalswitch value / 0.006
→
Quotient and Remainder
• Programming
method
To handle 0.006 as an integer 6, multiply both the dividend and divisor by 1000.
Quotient
Remainder
(Decimal part)
X0
The calculation of
Example1 is
commanded.
D0
K4X30
BINP
D1
K314
D0
*P
X1
D10
K100
D1
D/P
K8Y50
D10
DBCD
K2Y48
D12
BCD
K2Y40
K0
MOV
X1
D20
K4X30
BINP
D21
K1000
D20
*P
X0
D30
K6
D21
D/P
K8Y50
D30
DBCD
K4Y40
D32
BCD
The calculation of
Example2 is
commanded.
Displays the integral part (quotient).
Displays the decimal part (remainder).
Imports the set value of the digital switch into D20.
Quotient Remainder
Displays a quotient.
Displays a remainder.
Imports the set value of the digital switch into D0.
D0
314
D2
D1
D2
D1
100
D11 D10 D13 D12
D20
1000
D22 D21
D22 D21
6
D31 D30 D33 D32
REMARK
QCPU has instructions which can process actual number (floating decimal
point) operation data for highly accurate operations.
As long as the instructions are used, careful attentions for the place of the
decimal point as shown above are unnecessary.
point) operation data for highly accurate operations.
As long as the instructions are used, careful attentions for the place of the
decimal point as shown above are unnecessary.
(K2Y48)
(K8Y50)
(Circular constant)
(K4X30)
(K4Y40)
(K8Y50)
(K4X30)