Problem Summary
On a SIMATIC S7-300 CPU 313C (6ES7313-5BF03-0AB0 or comparable compact CPU with integrated digital/analog I/O), a ladder program that calls FC105 (SCALE) to normalize an analog input value into a 0–100% engineering range sends the CPU into STOP mode. The red SF (System Fault) LED illuminates, and Step 7 Monitor reports "Module is in operating mode STOP". Network 1 of the program operates correctly; the fault only appears when Network 2 containing FC105 is downloaded or scanned.
This fault pattern has three root causes, all of which must be verified before the CPU returns to RUN:
- The FC105 block is not present in the S7 project on the CPU (or only on the programming device).
- The analog input address PIW xxx referenced by FC105 is not configured in HW Config.
- The CPU is missing the diagnostic organization blocks (OB 121 / OB 122) that would otherwise allow it to continue running and just log the access error.
CPU 313C Integrated I/O Address Map
The CPU 313C family (313C, 313C-2 DP, 313C-2 PtP, 314C-2 DP/PtP) integrates 24 digital inputs, 16 digital outputs, 4 or 5 analog inputs (AI), and 2 analog outputs (AO) directly on the CPU module. The I/O addresses are not Q0.0 / I0.0 by default. They follow the SIMATIC S7-300 compact-CPU address convention and depend on the slot in HW Config:
| Signal Type | CPU 313C Default Address Range | Width |
|---|---|---|
| Digital inputs (integrated) | I 124.0 – I 126.7 | 24 bits (3 bytes) |
| Digital outputs (integrated) | Q 124.0 – Q 125.7 | 16 bits (2 bytes) |
| Analog inputs (integrated) | PIW 752 – PIW 758 (or PIW 754 – PIW 760) | 4 channels (5 on -2 variants) |
| Analog outputs (integrated) | PQW 752 – PQW 754 | 2 channels |
The exact PIW/PQW start address is shown in HW Config → double-click the CPU 313C → "Addresses" tab, and again on the integrated I/O sub-module row. Tutorials that show Q0.0 as the first digital output of a CPU 313C are either using a 314/315 rack CPU, or have explicitly remapped the address by changing the integrated I/O start address in HW Config. Do not assume Q0.0 is valid on a stock CPU 313C.
FC105 (SCALE) Block Technical Reference
FC105 is a Siemens standard library function that converts an integer input (IN) into a real output scaled between a defined lower limit (LO_LIM) and upper limit (HI_LIM). It is the direct sibling of FC106 (UNSCALE), which performs the inverse operation.
Inputs / Outputs of FC105:
| Parameter | Type | Description |
|---|---|---|
| EN | BOOL | Enable input (from rung) |
| IN | INT | Input value to be scaled (typically PIW xxx) |
| HI_LIM | REAL | Upper scale limit in engineering units |
| LO_LIM | REAL | Lower scale limit in engineering units |
| BIPOLAR | BOOL | 0 = unipolar (0–27648), 1 = bipolar (-27648 to +27648) |
| RET_VAL | WORD | Return value; W#16#0000 = OK, non-zero = error |
| OUT | REAL | Scaled result in engineering units |
Scaling formula (unipolar, BIPOLAR = 0):
OUT = ((IN - 0) / (27648 - 0)) * (HI_LIM - LO_LIM) + LO_LIM
Scaling formula (bipolar, BIPOLAR = 1):
OUT = ((IN - (-27648)) / (27648 - (-27648))) * (HI_LIM - LO_LIM) + LO_LIM
FC105 resides in the Standard Library → TI-S7 Converting Blocks (or in STEP 7 V5.x: Libraries → Standard Library → TI-S7 Converting Blocks → FC105). The block must be copied from this library into the Blocks folder of the S7 project on the offline PC, compiled, and downloaded into the CPU. FC105 is a function (FC), not a function block (FB), so it does not require an instance DB.
Root Cause 1 — FC105 Not Loaded in CPU
The most common cause of a STOP on first use of FC105 is that the block is present in the STEP 7 project on the programming device but was never downloaded to the CPU. When the OB1 scan reaches the FC105 call and cannot resolve the block number, the CPU's operating system reports an "OB not loaded / FC not loaded" event and transitions to STOP (provided the relevant error OB is also absent — see Root Cause 3).
Diagnostic buffer evidence:
- Event ID 16#4570 — "Error in FC" or "Block not found"
- Event ID 16#4302 — "STOP due to missing/incorrect OB"
- Block type: FC, block number: 105
- Registered event: "FC105 not loaded"
Fix: In SIMATIC Manager, open the Blocks folder of the S7 program, confirm FC105 is listed, right-click → Download (or use PLC → Download). If FC105 is missing from the project, navigate to Libraries → Standard Library → TI-S7 Converting Blocks, drag FC105 into the project's Blocks container, save/compile, then download.
Root Cause 2 — Unconfigured PIW Address
If the IN input of FC105 is wired to an analog input (e.g., PIW 756) that does not exist in the hardware configuration, the CPU raises an I/O access error at runtime. With a stock CPU 313C and default addressing, the four integrated analog channels typically sit at PIW 752, 754, 756, 758 (verify in HW Config). If HW Config has been edited, deselected, or never had the integrated AI sub-module enabled, the address is unassigned.
Diagnostic buffer evidence:
- Event ID 16#2942 — "I/O access error when reading"
- Byte-level access violation on the configured address byte
- Error class: B (peripheral access)
Fix (HW Config approach):
- Open HW Config in the STEP 7 project.
- Double-click the CPU 313C row → confirm "Integrated I/O" is enabled and the analog input sub-module row is present.
- Open the Addresses tab and note the start address of the integrated AI.
- For each analog channel, set the measurement type (voltage 0–10 V, current 0–20 mA, 4–20 mA, RTD, etc.) and the diagnostic/interrupt behavior.
- Save, compile, and download the hardware configuration to the CPU (Stop → Download → Run).
If 4–20 mA is desired (the most common industrial loop), the channel must be set to "Current (2DMU)" / 4-wire transducer, 4–20 mA. The numeric input value at 4 mA is 0, at 20 mA is 27648. Negative values (broken wire with 4–20 mA sensors) appear in the underrange area and are clamped to -1 (16#FFFF) by FC105's bipolar logic if BIPOLAR=1 is not used.
Fix (alternative wiring): If the application does not actually need a real field input while commissioning, wire FC105's IN to a free, configured analog input or to a constant 16#0000 during testing. A simple "smoke test" verifies the FC105 logic is intact before chasing the hardware address.
Root Cause 3 — Missing Error OBs (OB 121 / OB 122)
An S7-300 CPU only continues to run after a programming or I/O access error if the corresponding error OB is loaded. The mapping is:
| Error OB | Triggered by | If Missing |
|---|---|---|
| OB 121 | Programming error (e.g., BCD conversion, division by zero, illegal data type) | CPU goes to STOP |
| OB 122 | I/O access error (read/write to non-existent or faulty peripheral) | CPU goes to STOP |
| OB 80 | Time-of-day interrupt / time error | CPU goes to STOP |
| OB 82 | Diagnostic interrupt | CPU goes to STOP |
A field engineer who has been "bitten" by a PLC that won't keep running can add empty OB 121 and OB 122 stubs to the project, download them, and the CPU will simply log the error in the diagnostic buffer and continue. This is a powerful diagnostic technique, but it is not a fix — it only reveals the underlying cause. Always resolve the root cause and only then consider whether the error OBs should remain as a safety net or be removed.
To add empty OBs: Blocks → right-click → Insert New Object → Organization Block, type OB 121 (or 122), confirm, save, compile, download. The empty stub contains only the OB's end statement and is enough to satisfy the operating system.
Reading the S7-300 Diagnostic Buffer
The diagnostic buffer is the single most useful first-stop tool when the SF LED is lit.
- With STEP 7 online to the CPU, open the Blocks folder.
- Press Ctrl + D, or select PLC → Diagnostic/Setting → Diagnostic Buffer.
- The newest event is at the top. Click the topmost entry and read the Event ID, Block type/number, and the supplementary information bytes.
- For deeper analysis, click "Open Block" on a programming error event to open the offending block at the exact line that raised the error.
- Click "Help on Event ID" for Siemens' built-in description of any listed event.
Common event IDs you will encounter during this type of fault:
| Event ID (hex) | Meaning |
|---|---|
| 16#4302 | STOP due to missing/incorrect OB (often OB 121 / OB 122) |
| 16#4570 | Block error: FC/FB not loaded, or block number not found |
| 16#2942 | I/O access error (read) |
| 16#2943 | I/O access error (write) |
| 16#3501 | Diagnostic interrupt from a module |
| 16#39B1 | Analog input wire break / overflow / underflow |
Step-by-Step Resolution Procedure
- Confirm the SF LED state and read the diagnostic buffer (Ctrl + D). Note the topmost event ID and the referenced block number.
- Check the Blocks folder in the online view (PLC → Accessible Nodes or PLC → Monitor/Modify). If FC105 is shown with a red dot or absent, it is not on the CPU.
- Open the offline S7 project on the PG. If FC105 is in Libraries → Standard Library → TI-S7 Converting Blocks but not in the Blocks folder, drag it in.
- Compile the program (Station → Save and Compile).
- Download the Blocks folder to the CPU (PLC → Download). The CPU will transition to STOP briefly and then to RUN if the download is clean.
- Verify the analog input wiring in HW Config. Ensure the integrated AI sub-module is enabled, the measurement type is set to the actual loop type, and the start address matches the PIW used in FC105.
- Add OB 121 and OB 122 if you want continued-run protection while troubleshooting a non-critical I/O error.
-
Cycle the CPU to RUN and monitor the FC105
RET_VALfor 16#0000. Non-zero return values indicate out-of-range IN (e.g., bipolar signal interpreted as unipolar, or a wire break).
Verification Checklist
- SF LED is off; DC 5V and RUN LEDs are green.
- Diagnostic buffer top entry is "RUN" (or a benign informational entry).
- OB1 is being scanned: in Monitor, Network 1 (if digital) and Network 2 (FC105) both show "RLO = 1" in their contact and coil conditions.
- FC105's
OUTtracks the input: with IN = 0, OUT equals LO_LIM; with IN = 27648, OUT equals HI_LIM (unipolar, 4–20 mA sensor at 20 mA yields 100% if HI_LIM = 100 and LO_LIM = 0). - Force or simulate a value: temporarily wire IN to a known constant and confirm the scaling math.
Worked Example — Scaling a 4–20 mA Pressure Transducer to 0–100%
Field device: pressure transmitter, 0–10 bar, 4–20 mA loop.
CPU 313C channel: integrated AI 0, configured in HW Config as 4–20 mA, 4-wire, address PIW 752.
FC105 call (LAD, Network 2):
IN = PIW 752 // 0..27648 over 4..20 mA
HI_LIM = 1.0E+2 // 100.0 (% or bar, depending on application)
LO_LIM = 0.0
BIPOLAR = FALSE
RET_VAL = MW 100 // Check for 16#0000
OUT = MD 104 // REAL result, e.g. 0.0 .. 100.0
Math check: at 12 mA (mid-scale), IN = 13824, OUT = (13824 / 27648) * 100 = 50.0. This is the value the HMI should display as 50% / 5.0 bar.
Common Pitfalls and Field Notes
- Q0.0 / I0.0 assumption. Compact CPUs do not start their integrated I/O at zero. Always check the HW Config addresses, not a tutorial copied from a rack CPU.
- Block in PG only. STEP 7 keeps a project database on the programming device; downloading the S7 program does not auto-download standard library blocks unless they are copied into the project's Blocks folder.
-
PIW vs IW. FC105 expects a peripheral input word (
PIW) at the IN parameter. Using the process-image input word (IW) at the same address will still work, butPIWis the canonical choice because it bypasses the I/O update cycle and reflects the most recent value. - FC105 vs FC106 confusion. FC105 is for IN → OUT scaling (analog input to engineering units). FC106 is the reverse (engineering units to analog output value). Using FC106 on an input signal will produce nonsense output.
- OB 1 scan order. FC105 is called in OB1 on each scan. If the analog module is in diagnostic mode and the input is faulted, the IN value will be 16#7FFF (or 16#8000 for some Siemens modules). FC105 does not check for that; it scales whatever value it sees.
- Step 7 V5.x vs TIA Portal. On a CPU 313C programmed from TIA Portal, the FC105/FC106 equivalents are still usable but Siemens recommends the modern SCALE / NORM_X instructions in SCL or LAD. The diagnostic procedure and event IDs are functionally identical.
Reference Documentation
For further detail on FC105, the integrated I/O address map of the CPU 313C, and S7-300 diagnostic event IDs, consult the official Siemens manual set:
- SIMATIC S7-300 Automation System, CPU 313C / 314C Technical Data (manual entry on the Siemens Industry Online Support portal)
- SIMATIC Standard Library for STEP 7 V5.x — Converting Blocks (FC105 / FC106)
- STEP 7 V5.x Programming with LAD/FBD and STL — Diagnostic Buffer
- S7-300/400 System and Standard Functions — Organization Blocks (OB 121, OB 122)
- S7-300 CPU 313C / 314C Integrated I/O Addressing
FAQ
Why does my CPU 313C go to STOP the moment I add Network 2 with FC105?
Because FC105 has not been downloaded to the CPU, or the analog input address wired to FC105's IN is not configured in HW Config. The CPU operating system raises a "block not loaded" or "I/O access error" event and, because the matching error OB (OB 121 or OB 122) is also missing, transitions the CPU to STOP. Read the diagnostic buffer (Ctrl + D) to confirm the exact event ID and referenced block.
My CPU 313C integrated outputs are at Q124.0, not Q0.0. Is that normal?
Yes. The compact CPU 313C, 313C-2 DP, 313C-2 PtP, and 314C-2 integrate their I/O and use the default address range Q 124.0 – Q 125.7 for the 16 digital outputs. The address shown in HW Config under the CPU's "Addresses" tab is authoritative; always reference the address from HW Config, not from a generic tutorial.
How do I check whether FC105 is actually on the CPU and not just on my programming device?
In SIMATIC Manager, go online to the CPU and open the Blocks folder online view. If FC105 appears with a red diagonal or is missing from the list, the CPU does not have it. Re-open the offline project, confirm FC105 is in the Blocks folder (drag it in from Standard Library → TI-S7 Converting Blocks if needed), save/compile, and perform a full Blocks download.
What is the difference between FC105 and the modern SCALE_X / NORM_X instructions?
FC105 is a fixed-function block from the STEP 7 V5.x standard library that scales a 16-bit INT (0–27648 unipolar, ±27648 bipolar) into a REAL between two user-defined limits, in one step. The TIA Portal successors NORM_X and SCALE_X are generic INT/REAL-to-REAL blocks that you call twice (NORM_X to normalize 0.0–1.0, then SCALE_X to scale to your engineering range) and accept any data type. The diagnostic procedure, however, is the same: check that the block is loaded and that the analog input address is configured in HW Config.
Can I keep the CPU running by adding empty OB 121 / OB 122 stubs?
Yes, that is a valid diagnostic technique. Adding an empty OB 121 and OB 122 to the project and downloading them makes the CPU log the programming/I/O access error to the diagnostic buffer and continue running instead of going to STOP. It does not fix the underlying cause — the error will recur every scan — so use it to gather information, then resolve the real problem and decide whether the stubs should remain as a safety net or be removed.
My FC105 RET_VAL is non-zero. What does that mean?
RET_VAL is W#16#0000 when the input value IN is within the valid range and the scaling succeeds. A non-zero return value indicates that IN is out of range (e.g., a 4–20 mA signal producing a value below 0 or above 27648), the bipolar/unipolar setting does not match the hardware configuration, or the input word has a diagnostic fault. Treat any non-zero RET_VAL as a signal to inspect the analog channel's status and the field wiring.