6.1.3.4.5 DIV
Function
Divide ( / ), divide the value of input IN2 by the value of input IN2, and query the quotient value at output OUT (OUT:=IN1/IN2)
LD Graphics
Parameter description
| Interface variable | Declaration | Data type | Description |
|---|---|---|---|
| IN1 | Var_Input | ANY_NUM | Dividend |
| IN2 | Var_Input | ANY_NUM | Divisor |
| OUT | Var_Output | ANY_NUM | Quotient |
Example
The result obtained by dividing the value of variable a by the value of variable b is given to variable c through the DIV instruction, as shown in the figure below: three INT type variables are defined, and the DIV instruction is executed by compiling, downloading, and realizing c:=a/b

warning
- The result of integer division of the DIV function is an integer of the same type, with a remainder of zero. For example: 7/3=2
- The DIV function will report an error if the dividend is zeross