ADD Add
Also called: addition, sum, plus, +
OUT := IN1 + IN2 when the rung is 1.
What it does
The ADD block adds two values and writes the result into OUT.
When to use it
To accumulate, offset a value, compute a total.
Operands
| European mnemonic | American mnemonic | Name | Data type | Direction | Required | Meaning |
|---|---|---|---|---|---|---|
| EN | EN | Enable | BOOL | Input | Yes | Rung condition: the computation runs only when power flow is 1. |
| IN1 | IN1 | Source A | INT, DINT, REAL, TIME / DINT | Input | Yes | First operand. |
| IN2 | IN2 | Source B | INT, DINT, REAL, TIME / DINT | Input | Yes | Second operand. |
| OUT | OUT | Destination | INT, DINT, REAL, TIME / DINT | Output | No | Result (variable). Not changed while the rung is 0. |
| ENO | ENO | Enable out | BOOL | Output | No | 1 when the computation ran without error. |
| Mnemonic | Name | Data type | Direction | Required | Meaning |
|---|---|---|---|---|---|
| EN | Enable | BOOL | Input | Yes | Rung condition: the computation runs only when power flow is 1. |
| IN1 | Source A | INT, DINT, REAL, TIME | Input | Yes | First operand. |
| IN2 | Source B | INT, DINT, REAL, TIME | Input | Yes | Second operand. |
| OUT | Destination | INT, DINT, REAL, TIME | Output | No | Result (variable). Not changed while the rung is 0. |
| ENO | Enable out | BOOL | Output | No | 1 when the computation ran without error. |
| Mnemonic | Name | Data type | Direction | Required | Meaning |
|---|---|---|---|---|---|
| EN | Enable | BOOL | Input | Yes | Rung condition: the computation runs only when power flow is 1. |
| IN1 | Source A | INT, DINT, REAL | Input | Yes | First operand. |
| IN2 | Source B | INT, DINT, REAL | Input | Yes | Second operand. |
| OUT | Destination | INT, DINT, REAL | Output | No | Result (variable). Not changed while the rung is 0. |
| ENO | Enable out | BOOL | Output | No | 1 when the computation ran without error. |
Example
When S1 is 1, V3 := V1 + V2.
Try it in the simulatorThe example opens in the free simulator; your own program stays as it was.
Behaviour in detail
- The computation runs on every scan where the rung is 1: V1 := V1 + 1 adds 1 on every scan; put an edge contact before it to add 1 per press.
- Overflow: an INT goes from 32,767 to −32,768 (the result wraps around), a DINT likewise on 32 bits; a REAL does not overflow.
- Types: INT, DINT, REAL, TIME.