Skip to main content

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

alt text

Parameter description

Interface variableDeclarationData typeDescription
IN1Var_InputANY_NUMDividend
IN2Var_InputANY_NUMDivisor
OUTVar_OutputANY_NUMQuotient

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

alt text

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