Basic Function Instruction
6-30
FUN 14 D P
(/)
DIVISION
(Performs division of the data specified at Sa and Sb and stores the result in D)
FUN 14 D P
(/)
Symbol
Operand
Sa: Dividend
Sb: Divisor
D : Destination register to store the results
of the division.
Sa, Sb, D may combine with V, Z, P0~P9
to serve indirect addressing
WX WY WM WS TMR CTR HR IR OR SR ROR DR K XR
Range
Ope-
rand
WX0
∣
WX240
WY0
∣
WY240
WM0
∣
WM1896
WS0
∣
WS984
T0
∣
T255
C0
∣
C255
R0
∣
R3839
R3840
∣
R3903
R3904
∣
R3967
R3968
∣
R4167
R5000
∣
R8071
D0
∣
D4095
16/32-bit
+/− number
V、Z
P0~P9
Sa ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
Sb ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○ ○
D ○ ○ ○ ○ ○ ○ ○ ○* ○* ○ ○
Description
● Performs the division of the data specified at Sa and Sb and writes the quotient and remainder to registers
specified by register D when the division control input "EN" =1 or "EN↑" ( P instruction) from 0 to 1. If the
quotient of division is equal to 0 then set FO0 to 1. If the divisor Sb=0 then set the error flag FO1 to 1 without
executing the instruction.
Example 1 16-bit division
Ladder Diagram Key Operations Mnemonic Codes
X0
EN
Sa:
Sb:
R
R
0
1
2
14P.(/)
D=0
ERR
U/S
D :
R
ORG
ORG X 0
FUN 14
Sa: R 0
Sb: R 1
D: R 2
R0
Sa
256
Dividend
R1
÷ Sb
12
Divisor
R3 R2
D
4 21
Remainder Quotient