Omron CJ - REFERENCE MANUAL 02-2010 Reference Manual page 498

Table of Contents

Advertisement

3. Instructions
Application example
In this example, the 4-digit BCD number in D0 is divided by the 4-digit BCD number in D1 and the
floating-point result is written to D3 and D2.
(Example) 0.3452 104 0.0079 104=0.436962 102
0.00
462
To perform the floating point division, the BCD value
@MOV
in D0 is converted to floating-point format in D101
1
and D100 and the BCD value in D1 is converted to
D100
floating-point format in D103 and D102.
@MOV
D0
D102
3
4
@MOV
D101
4
3
4
5
2
D101
2. D101 and D103 are set
@MOV
to 4000.
D103
3 to 6. MOVD(083) is used to move the digits of the
3
@MOVD
original source words to the proper digits in the
D0
2-word floating-point formats.
D101
7. FDIV(079) divides the floating-point number in D101
4
@MOVD
and D100 by the floating-point number in D103 and
D0
D102.
D100
The result of the calculation and the quotient are output
to D3 and D2.
5
@MOVD
D1
D101
4
3
D103
D103
6
@MOVD
4
0
D1
2
4
D102
@FDIV
7
D100
D102
D2
5
2
0
D100
D103
2
0
0
0
4
0
1. D100 and D102 are set
to 0000.
D100
4
5
2
0
0
0
0.3452000
D102
0
7
9
0
0
0
0.0079000
D3
D2
3
6
9
6
2
0
0.4369620
CS/CJ/NSJ Series Instructions Reference Manual (W474)
D1
0
7
9
D102
0
7
9
0
0
0
4
10
4
10
2
10

Advertisement

Table of Contents
loading

Table of Contents