S5 AWL Commands: +F, -F, +G (Integer Arithmetic)
S5 AWL arithmetic instructions: +F (INT add), -F (INT subtract), +G (DINT add). Operates on ACCU1 and ACCU2. S7 equivalents: +I, -I, +D.
S5 AWL Commands: +F, -F, +G (Integer Arithmetic)
S5 AWL arithmetic operates on the two accumulators: ACCU2 (operator) and ACCU1 (operand). The result goes into ACCU1. ACCU2 is unchanged.
Instructions
| S5 AWL | Operation | S7 STL | Data Type |
|---|---|---|---|
| +F | ACCU1 = ACCU2 + ACCU1 | +I | INT (16-bit, -32768…+32767) |
| -F | ACCU1 = ACCU2 - ACCU1 | -I | INT (16-bit) |
| +G | ACCU1 = ACCU2 + ACCU1 | +D | DINT (32-bit, -2147483648…+2147483647) |
| -G | ACCU1 = ACCU2 - ACCU1 | -D | DINT (32-bit) |
Code Example — Add Two Values
L MW 10 // Load first value → ACCU1
L MW 20 // First value moves to ACCU2, second → ACCU1
+F // ACCU1 = MW10 + MW20 (INT addition)
T MW 30 // Store result
S7 STL: L MW 10 / L MW 20 / +I / T MW 30 (identical logic, different mnemonic)
S7 SCL: MW30 := MW10 + MW20;
Important: Operand Order
The first L goes into ACCU2 (after the second L pushes it there). The second L is in ACCU1. For subtraction: ACCU2 - ACCU1 = first loaded - second loaded.
L MW 10 // 100 → ACCU1, then pushed to ACCU2
L MW 20 // 30 → ACCU1
-F // ACCU1 = 100 - 30 = 70
T MW 30 // MW30 = 70
Overflow Detection
After +F/-F, the overflow flags (OV, OS) indicate if the result exceeded the INT range. Check with:
+F
SPO =OVERFLOW // Jump if overflow occurred
S7 Equivalents Summary
| S5 | S7 STL | S7 SCL | Operation |
|---|---|---|---|
| +F | +I | a + b | INT addition |
| -F | -I | a - b | INT subtraction |
| +G | +D | a + b | DINT addition |
| -G | -D | a - b | DINT subtraction |
| ×F | *I | a * b | INT multiplication |
| :F | /I | a / b | INT division |
Part of the S5 AWL Command Reference. Maintained by PLCcheck.ai.
Analyze Your S5 Code Automatically
PLCcheck Pro reads your complete S5 AWL program and explains every instruction — including this one — in plain language. Upload your code and get instant documentation, S7 equivalents, and migration guidance.
Upload S5 code for free analysis → | S5→S7 Migration Guide →
Related Articles
Reading and Understanding S5 AWL Code: A Practical Guide
Learn to read Siemens S5 AWL (Instruction List) code from scratch. Covers the accumulator model, bit logic, load/transfer, timers, counters, jumps, and data blocks with real code examples and line-by-line explanations.
16 min read
migration-guideThe Siemens S5/S7 Converter Tool: What It Does and What It Doesn't
Honest assessment of the Siemens STEP 7 S5→S7 conversion tool. What it converts automatically, what it cannot handle, common errors, and how to deal with the remaining 20–40% that requires manual work.
12 min read
migration-guideS5 to S7 Migration: The Complete Guide (2026)
Step-by-step guide for migrating Siemens S5 PLC programs to S7-1500. Covers AWL→SCL conversion, timer mapping, address translation, and hardware selection.
18 min read
Analyze your PLC code with AI
PLCcheck Pro explains, documents, optimizes, and migrates PLC code — automatically.
Try PLCcheck Pro →Not affiliated with Siemens AG. S5, S7, STEP 5, STEP 7, and TIA Portal are trademarks of Siemens AG.