377
3. Instructions
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Symbol Math Instructions
3
/, /L
Function
z /
/(430) divides the signed binary (16 bit) values in Dd by those in Dr and outputs the result to R, R+1.
The quotient is placed in R and the remainder in R+1.
Note Division of hexadecimal #8000 by #FFFF is undefined.
z /L
/L(431) divides the signed binary values in Dd and Dd+1 by those in Dr and Dr+1 and outputs the result
to R, R+1, R+2, and R+3. The quotient is output to R and R+1 and the remainder is output to R+2 and
R+3.
Note Division of hexadecimal #80000000 by #FFFFFFFF is undefined.
Example Programming
z Example in Function Block Definition
In the following example, an array variable is used to get the quotient and remainder from the function
block.
÷
R+1 R
Dd
Dr
Remainder Quotient
(Signed binary)
(Signed binary)
(Signed binary)
÷
R+1 R R+3 R+2
Dd+1 Dd
Dr+1 Dr
Remainder
(Signed binary)
(Signed binary)
(Signed binary)
Quotient
/
D100
D110
D120
0.00
When CIO 0.00 is ON in the following example, D100 will be
divided by D110 as 4-digit signed binary values and the
quotient will be output to D120 and the remainder to D121.
/L
D100
D110
D120
0.00
When CIO 0.00 is ON in the following example, D101 and
D100 are divided by D111 and D110 as 8-digit signed
hexadecimal values and the quotient will be output to D121
and D120 and the remainder to D123 and D122.
a / b → c ··· d
/
a
b
tmp[0]
MOV
tmp[0]
c
Function Block Variables
Dividend: a (data type: INT)
Divisor: b (data type: INT)
Quotient: c (data type: INT)
Remainder: d (data type: INT)
Temporary variable: tmp (data type: WORD, 2-element array)
MOV
tmp[0]
d