2 Instruction Descriptions
2-166
NJ-series Instructions Reference Manual (W502)
DIV (/)
The DIV (/) instruction divides integers or real numbers.
* If you omit an input parameter, the default value is not applied. A building error will occur.
The DIV (/) instruction divides dividend In1 by divisor In2 and outputs the result. The data types of In1,
In2, and division result Out can have different data types. If In1, In2, and Out are integers and there is a
remainder, the remainder is truncated.
The following example is for when In1 is INT#100 and In2 is INT#5. The value of variable abc will be
INT#20.
Instruction Name FB/FUN Graphic expression ST expression
DIV (/) Division FUN Out:=In1/ In2;
Variables
Name Meaning I/O Description Valid range Unit Default
In1 Dividend
Input
Dividend
Depends on data type. --- *
In2 Divisor Divisor
Out Division
result
Output Division result Depends on data type. --- ---
Boolean
Bit string Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
In1 OKOKOKOKOKOKOKOKOKOK
In2 OKOKOKOKOKOKOKOKOKOK
Out OKOKOKOKOKOKOKOKOKOK
Function
(@)DIV
EN ENO
In1 Out
In2
(@)/
EN ENO
In1 Out
In2
abc:=INT#100/INT#5;
LD ST
abc
INT#100
INT#5
DIV
EN ENO
In1
In2