You are here: Core Reference > Coding > Logic > DIV

DIV

Function Name

DIV

ST Operator

/

Description

The output is the result of Input 1 divided by Input 2. On a Function Block Diagram, Input 1 is the top input and Input 2 is the bottom input.

Arguments

Input 1 {ANY_NUM}

Input 2 {ANY_NUM}

For more information on the data types for the inputs and outputs, see Data Type Hierarchy.

Returns

Output {Same data type as Input 1}

The value of Input 1 divided by Input 2. The type of output is dependent on the inputs.

NOTE: For integer inputs, the output is the same as Input 1 except that the fractional part of the value is discarded.

Example:

Function Block Diagram - DIV:

Input 1 is 10 (the top input) and Input 2 is 5 (the bottom input). The output is 5 as 10 divided by 5 is

ST Program - DIV:

The DIV function is used to provide the result of Input 1 divided by Input 2.

  • Output := Input 1 / Input 2;

Where Output, Input 1 and Input 2 are defined as variables earlier in the ST program. In this case, let's assume Input 1 is 60 and Input 2 is 10. The DIV function returns 6 as 60/10=6.

Alternatively, the same calculation can be made by using the following syntax:

  • Output := DIV (Input 1, Input 2);

ClearSCADA 2015 R2