Concept Flow - Math instructions (ADD, SUB, MUL, DIV)
Start
Read Inputs
Select Operation
Perform Calculation
Store Result
End
The PLC reads inputs, selects the math operation (add, subtract, multiply, divide), performs it, and stores the result.
ADD 5, 3 -> Result SUB 10, 4 -> Result MUL 2, 6 -> Result DIV 12, 3 -> Result
| Step | Instruction | Operands | Calculation | Result |
|---|---|---|---|---|
| 1 | ADD | 5, 3 | 5 + 3 | 8 |
| 2 | SUB | 10, 4 | 10 - 4 | 6 |
| 3 | MUL | 2, 6 | 2 * 6 | 12 |
| 4 | DIV | 12, 3 | 12 / 3 | 4 |
| 5 | DIV | 12, 0 | 12 / 0 | Error: Division by zero |
| Variable | Start | After ADD | After SUB | After MUL | After DIV |
|---|---|---|---|---|---|
| Result | undefined | 8 | 6 | 12 | 4 |
Math instructions in PLC: - ADD: adds two numbers - SUB: subtracts second from first - MUL: multiplies two numbers - DIV: divides first by second (no zero divisor) - Result stores output after each operation
ADD instruction do in PLC programming?SUB source1, source2, destination matches the correct order and separators (commas).ADD 5, 3, D1 MUL D1, 2, D2 SUB D2, 4, D3 DIV D3, 2, D4
D4?DIV 10, 0, D1
S1, S2, and S3 using PLC math instructions. Which sequence correctly computes the average and stores it in AVG?Pass the test and this pattern moves unknown