# Math Functions in Ladder Diagram

Basic math functions like **ADD**, **SUB**, **MUL**, and **DIV** are used for fundamental arithmetic operations. **ADD** performs addition, **SUB** handles subtraction, **MUL** carries out multiplication, and **DIV** conducts division. These functions take in operands as inputs and deliver the calculated results as outputs, serving as building blocks for more complex control logic in industrial automation.

## Symbol

## Configuration

Two input parameters, **IN1** and **IN2**, along with one output parameter, **OUT**, are required for each basic math function in Ladder Logic. The function block is controlled by two additional parameters: **EN** for enabling and **ENO** for indicating that the block is enabled. Specifically, **EN** activates the function block, while **ENO** confirms its active status. The operands for the calculation are fed into **IN1** and **IN2**, and the computed result is stored in **OUT**.

It's important to note that only **Number** or **Time** variable types are permitted for these input and output parameters.

## Runtime Behavior

When **EN** is set to **true**, the math function gets executed. The result is stored in **OUT**, and **ENO** also becomes **true** to indicate the function is active. If **EN** is set to **false**, the function is disabled, and **ENO** is set to **false** to confirm it's turned off. If **EN** remains **true**, the function will run in every cycle scan. To run the function only a single time, you can use Positive or Negative Transition-Sensing Contacts.

## Addition

`Result = Input1 + Input2`

## Subtraction

`Result = Input1 - Input2`

## Multiplication

`Result = Input1 \* Input2`

## Division

`Result = Input1 / Input2`