Omron CJ - INSTRUCTIONS REFERENCE MANUAL 07-2009 Reference Manual page 406

Programmable controllers
Hide thumbs Also See for CJ - INSTRUCTIONS REFERENCE MANUAL 07-2009:
Table of Contents

Advertisement

Function
/
/(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.
/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.
Sample program
Example in Function Block Definition
In the following example, an array variable is used to get the quotient and remainder from the function
block.
a / b → c ··· d
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Dd
(Signed binary)
Dr
(Signed binary)
R+1
R
(Signed binary)
Remainder
Quotient
Dd+1 Dd
(Signed binary)
Dr+1 Dr
(Signed binary)
R+3 R+2
R+1
R
(Signed binary)
Remainder
Quotient
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
D100
quotient will be output to D120 and the remainder to D121.
D110
D120
0.00
/L
When CIO 0.00 is ON in the following example, D101 and
D100 are divided by D111 and D110 as 8-digit signed
D100
hexadecimal values and the quotient will be output to D121
D110
and D120 and the remainder to D123 and D122.
D120
Function Block Variables
Dividend: a (data type: INT)
/
Divisor: b (data type: INT)
a
Quotient: c (data type: INT)
b
Remainder: d (data type: INT)
Temporary variable: tmp (data type: WORD, 2-element array)
tmp[0]
MOV
tmp[0]
c
MOV
tmp[0]
d
3. Instructions
3
369

Advertisement

Table of Contents
loading

Table of Contents