S7-300 I/O Addressing Reference: AI, RTD, AO Slot Mapping

David Krause15 min read
S7-300SiemensTechnical Reference
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

S7-300 I/O Addressing Reference: AI, RTD, AO Slot Mapping

This technical reference covers SIMATIC S7-300 I/O addressing for analog input (AI), Resistance Temperature Detector (RTD), analog output (AO), digital input (DI), and digital output (DO) modules. It documents the slot-to-byte mapping used in STEP 7 HW Config, explains why AI modules occupy 1 word of address space while RTD modules occupy 2 words, and clarifies the difference between process-image access (IW) and peripheral access (PIW). Module order numbers, resolution figures, and indirect addressing techniques for the S7-300/400 CPU family are included.

Scope: This reference applies to SIMATIC S7-300 systems programmed with STEP 7 V5.x or TIA Portal. It focuses on the SM 331 analog input family (6ES7331-xxxx), SM 332 analog output family (6ES7332-xxxx), SM 321 digital input family (6ES7321-xxxx), and SM 322 digital output family (6ES7322-xxxx). Verify specific module behavior against the S7-300 Module Data manual before commissioning.

1. S7-300 Addressing Architecture Overview

The S7-300 uses a slot-based addressing scheme. Each module plugged into a rack (0-3) occupies a logical slot (4-11). The CPU assigns input and output addresses based on the module's position in HW Config, regardless of the physical slot number. The starting address of the first slot is fixed:

Rack Fixed Starting Address (Inputs) Fixed Starting Address (Outputs)
Rack 0 IB 0 / IW 0 / ID 0 QB 0 / QW 0 / QD 0
Rack 1 IB 32 / IW 32 / ID 32 QB 32 / QW 32 / QD 32
Rack 2 IB 64 / IW 64 / ID 64 QB 64 / QW 64 / QD 64
Rack 3 IB 96 / IW 96 / ID 96 QB 96 / QW 96 / QD 96

Each rack contributes a 32-byte input area and a 32-byte output area regardless of how many slots are populated. The address space within each rack starts at the boundary above and grows as modules are inserted in HW Config. Address gaps occur only when modules reserve space they do not fully use (notably 8-channel thermocouple modules that reserve 16 bytes for 4 usable channels).

2. Worked Addressing Example

The configuration below was used to validate the addressing scheme described in this reference. It covers two racks with a mix of analog, RTD, AO, DI, and DO modules.

2.1 Rack 0 — Analog and RTD Modules

Slot Module Type Order Number Address Range (Process Image) Bytes Reserved
5 AI 8x13Bit 6ES7331-1KF02-0AB0 IW 272 to IW 287 16
6 AI 8x13Bit 6ES7331-1KF02-0AB0 IW 288 to IW 303 16
7 RTD 8-channel 6ES7331-7PF01-0AB0 IW 304 to IW 319 16
8 RTD 8-channel 6ES7331-7PF01-0AB0 16
9 RTD 8-channel 6ES7331-7PF01-0AB0 IW 336 to IW 351 16
10 AO 8x12Bit 6ES7332-5HF00-0AB0 QW 352 to QW 367 16

2.2 Rack 1 — Digital I/O

Slot Module Type Order Number Address Range Bytes Reserved
4 DI 16x24VDC 6ES7321-1BH02-0AA0 I 32.0 to I 33.7 2
5 DI 16x24VDC 6ES7321-1BH02-0AA0 I 36.0 to I 37.7 2
6 DI 16x24VDC 6ES7321-1BH02-0AA0 I 40.0 to I 41.7 2
7 DO 16x24VDC/0.5A 6ES7322-1BH01-0AA0 Q 44.0 to Q 45.7 2
8 DO 16x24VDC/0.5A 6ES7322-1BH01-0AA0 Q 48.0 to Q 49.7 2
Address gap on Rack 1: Digital modules occupy 2 bytes (16 bits) each but STEP 7 inserts a 2-byte gap between slots. Slot 4 uses IB 32-33, Slot 5 starts at IB 36, Slot 6 at IB 40. The gap is intentional — it leaves room for future 32-channel digital modules and is reserved automatically by HW Config.

3. Why AI Uses 1 Word and RTD Uses 2 Words: Resolution Mechanics

The address footprint of an analog module is set by two factors: the number of channels and the internal word granularity. Standard AI modules (voltage, current, 4-wire RTD with 13-bit resolution) allocate 2 bytes per channel in HW Config. RTD modules with 24-bit Sigma-Delta converters also allocate 2 bytes per channel, but the second word is reserved for the channel's high-order data when configured for 4-wire mode.

3.1 Standard AI Modules — 13-Bit Resolution (12 bits + sign)

The SM 331 AI 8x13Bit (6ES7331-1KF02-0AB0) provides 13-bit resolution across 8 channels. The 16-bit process value is encoded as:

  • Bit 15: Sign bit
  • Bits 14-3: 12-bit magnitude
  • Bits 2-0: Reserved / zero

One 16-bit word per channel is sufficient because the entire measurement range fits in 13 bits. Each module reserves 16 bytes (8 words) of input address space.

3.2 RTD Modules — 24-Bit Internal / 16-Bit Process Resolution

The SM 331 RTD 8-channel (6ES7331-7PF01-0AB0) uses a Sigma-Delta converter with 24-bit internal resolution. The 24-bit conversion result is stored internally, but the user program sees a 16-bit representation:

  • Bit 15: Sign bit
  • Bits 14-0: 15-bit magnitude (one extra bit compared to standard AI)

The extra precision is achieved by averaging Sigma-Delta oversamples, not by widening the process word. Therefore an 8-channel RTD module reserves the same 16 bytes as an 8-channel AI module — but HW Config displays it as 16 bytes because the module reserves 2 bytes per channel for diagnostic/status data on top of the 2-byte process value when configured in 4-wire mode.

3.3 Thermocouple Modules — Address Gap Phenomenon

The SM 331 AI 8xTC (6ES7331-7KF02-0AB0) is an 8-channel thermocouple module, but only 4 channels are usable when channels are configured as thermocouple inputs (type J, K, T, etc.). The remaining 4 channels are reserved for cold-junction compensation. Each configured channel still occupies 2 bytes, but because HW Config allocates 16 bytes (8 words) for an 8-channel card and only 8 bytes (4 words) are usable, the address range appears to have "gaps."

Common pitfall: An 8-channel thermocouple module shows 8 words in HW Config. If you connect only thermocouples, only every second word contains valid data. The unused words return 0x7FFF (overflow) or 0x8000 (underflow). Always check the channel configuration in HW Config — modules with current-source channels used as reference junctions consume an address slot.

4. Process Image vs Peripheral I/O Access

S7-300 CPUs maintain two distinct I/O representations:

Access Type Mnemonic Update Mechanism Typical Use
Process Image I / Q / IB / IW / QB / QW Refreshed once per OB1 scan at cycle start and end Standard application logic
Peripheral I/O PI / PQ / PIB / PIW / PQB / PQW Direct read/write of the module's physical register High-speed acquisition, modules outside the process image

By default, S7-300 analog modules are configured outside the process image in HW Config (Object Properties → Addresses → "Process Image"). This means the values are not refreshed automatically and must be loaded with peripheral instructions:

// STL example — load analog input directly from peripheral
L PIW 272          // Read AI channel at IW 272 from module register
T DB10.DBW 0       // Store in data block

// Load and scale standard 0-10 V input
L PIW 272
ITD                  // Convert integer to double integer
DTR                  // Convert to real
L 2.7648e+4          // Full-scale value for unipolar 0-10 V
/R                   // Scale to 0.0 - 1.0 engineering unit
T MD 100             // Save scaled value

For modules that are configured inside the process image (the default for digital I/O on most CPU 31x models), use IW / QW directly. The process image guarantees consistent I/O snapshots across one OB1 scan.

4.1 Forcing Analog Modules into the Process Image

To place analog modules inside the process image, open the module in HW Config, select the "Addresses" tab, and change "Process Image" from "None" (default) to "OB1 PA" (process image updated by OB1). This forces OB1 to refresh those addresses on each scan cycle. Note that the CPU imposes a maximum of 2048 bytes for inputs and 2048 bytes for outputs across the entire process image — exceeding this limit returns an SF LED with a configuration error.

5. Indirect Addressing for S7-300/400

When the same logic block must process a variable number of channels, indirect addressing replaces fixed PIW references with computed offsets. The S7-300/400 STL supports two indirect-addressing modes.

5.1 Memory-Indirect Addressing (Intra-Area)

The address offset is stored in a WORD or DWORD tag of the local or global memory area. The address register AR1/AR2 is loaded at runtime:

// STL — memory-indirect PIW access
L 272                    // Initial offset
T MW 200                 // Store as WORD tag

L MW 200                 // Load offset
SLD 3                    // Shift left 3 = multiply by 8 (bit offset)
LAR1                     // Load AR1 with full pointer

L PIW [AR1,P#0.0]        // Indirect peripheral read
T DB20.DBW 0             // Store result

L MW 200                 // Load offset
+ 2                      // Increment by 2 (next word)
T MW 200                 // Save

L MW 200
SLD 3
LAR1
L PIW [AR1,P#0.0]        // Read next channel
T DB20.DBW 2

5.2 Area-Crossing Indirect Addressing (Register-Indirect)

The address pointer can switch between input (I), output (Q), and bit-memory (M) areas without code changes. The address register is 32 bits wide and contains the area identifier plus the byte/bit offset. Refer to the S7-300 Instruction List manual for the full register layout.

Pointer format: Bits 0-2 = bit offset (0-7), bits 3-15 = byte offset (0-65535), bits 16-31 = area identifier. The area identifier is a Siemens-defined constant: 1000 1000b = I area, 1000 1001b = Q area, 1000 1010b = M area, 1000 1011b = DB area, 1000 1100b = DI area, 1000 1101b = L area. Cross-area pointers are typically constructed as 32-bit hex constants or computed via the TAR1 / LAR1 instructions.

6. Module Order Number Reference

The following order numbers cover the most common analog and digital modules used in S7-300 racks. Confirm against current Siemens product catalogs before ordering.

Function Order Number Channels Resolution Address Footprint
AI 8x13Bit (V/I/RTD) 6ES7331-1KF02-0AB0 8 13 bit (12+sign) 16 bytes in
AI 8x14Bit (V/I) 6ES7331-1KF01-0AB0 8 14 bit (13+sign) 16 bytes in
AI 8xTC 6ES7331-7KF02-0AB0 8 (4 usable as TC) 15 bit + sign 16 bytes in
RTD 8-channel 6ES7331-7PF01-0AB0 8 24 bit internal / 15 bit + sign 16 bytes in
AI 2x12Bit 6ES7331-7KBx1-0AB0 2 12 bit + sign 4 bytes in
AO 8x12Bit 6ES7332-5HF00-0AB0 8 12 bit + sign 16 bytes out
AO 4x12Bit 6ES7332-5HD01-0AB0 4 12 bit + sign 8 bytes out
DI 16x24VDC 6ES7321-1BH02-0AA0 16 1 bit per channel 2 bytes in
DI 32x24VDC 6ES7321-1BL00-0AA0 32 1 bit per channel 4 bytes in
DO 16x24VDC/0.5A 6ES7322-1BH01-0AA0 16 1 bit per channel 2 bytes out
DO 32x24VDC/0.5A 6ES7322-1BL00-0AA0 32 1 bit per channel 4 bytes out

Always consult the Siemens Industry Online Support portal for the latest manual revisions. The S7-300 Module Data manual (entry ID 8859629 in the Siemens support portal) contains the canonical channel-by-channel addressing layout.

7. Verification Procedure

After configuring HW Config and downloading to the CPU, verify addressing with the following sequence:

  1. Online → Module Information: Open the project, go Online, right-click the CPU, and select "Module Information." Navigate to the "I/O Addresses" tab. Each module must list the same input and output addresses as your documentation.
  2. Monitor/Modify: Right-click any module in the rack view and select "Monitor/Modify." The address dialog shows the configured start address and the process values returned by each channel in real time.
  3. Variable Table (VAT):strong> Create a VAT in STEP 7 with the addresses IW272, PIW272, IW304, PIW304, etc. Open the VAT online and verify each address returns a sane value (not 0x7FFF / 0x8000, which indicate overflow or open wire).
  4. SF LED check: If the SF (System Fault) LED on the CPU is lit, the address assignment is inconsistent with the physical module plugged into the rack. Cross-check slot numbers against the HW Config.
  5. Symbol table audit: Open the symbol table (Options → Symbol Table) and confirm each I/O symbol is bound to the expected absolute address. Inconsistent symbols are a common source of intermittent process faults.

8. Common Addressing Mistakes and Diagnostics

Symptom Likely Cause Diagnostic Resolution
Analog channel returns 0x7FFF (32767) Open thermocouple or RTD lead Check wiring; verify channel configuration in HW Config matches sensor type Repair wiring; correct measurement range configuration
Analog channel returns 0x8000 (-32768) Underflow / negative overrange Check signal polarity; verify input range Re-wire; reconfigure range
DI channel reads correct value in OB1 but wrong in OB35 Module configured outside process image Open module in HW Config → Addresses tab Change "Process Image" from "None" to "OB1 PA" or assign to OB35 PA
CPU SF LED on, all I/O responding Address range overlap after module insertion Open Module Information → I/O Addresses Re-import the HW Config and re-download to CPU
Channel value updates only when OB1 runs Peripheral access (PIW) used inside OB35 Read source — confirm PIW vs IW Use IW if inside process image; use PIW if outside
Stop error "Peripheral addressing error" Module removed physically or failed Check SF LED on module itself Re-seat module; replace if hardware fault persists
Address offset on Rack 1 starts at 32 instead of 64 Rack 1 missing IM 360 or IM 361 wiring Check interconnecting cable and IM LEDs Verify IM360 (host) and IM361 (remote) installation

9. Practical Example: Scaling an RTD Input on 6ES7331-7PF01-0AB0

The following FC (function) reads the PT100 RTD on channel 0 of the first RTD module and converts the raw value to degrees Celsius. The 6ES7331-7PF01-0AB0 outputs 0.1 °C per LSB with a range of -200.0 to +850.0 °C. The raw word is signed (bit 15 = sign).

// FC100 — Read PT100 channel 0 of RTD module
// Input:  RTD module @ PIW 304 (8 channels, IW 304-319)
// Output: Temperature in 0.1 °C units (REAL)

L PIW 304               // Read channel 0 raw value
ITD                      // Convert INT to DINT
DTR                      // Convert DINT to REAL
T MD 100                 // Save engineering value

// Optional: 4-wire mode returns value already in 0.1 °C units
// The scaling library FC105 "SCALE" can be used for non-temperature ranges
// but for PT100 it is unnecessary if the module is configured for "RTD-4L" type

For modules configured for raw resistance measurement (0-300 Ω or 0-3000 Ω), the FC105 SCALE function block is required to convert the integer value to engineering units. Use:

CALL FC 105
  IN     := PIW304
  HI_LIM := 3.0e+2          // 300 Ω upper range
  LO_LIM := 0.0e+0          // 0 Ω lower range
  BIPOLAR:= FALSE           // Unipolar
  RET_VAL:= MW200           // Return value (status)
  OUT    := MD100           // Scaled REAL output

10. Communication Between Address Domains

When connecting an S7-300 to third-party HMIs or OPC servers, the address syntax may differ from the STEP 7 representation. Two common mapping conventions are documented below.

STEP 7 / TIA Portal OPC DA Server Modbus Gateway C-more HMI
DB18.DBW6 [S7]DB18,W6 Register 40018 (offset) DB18 W6
IW272 [S7]I272 Input register 30272 I272
QW352 [S7]Q352 Holding register 40352 Q352

The exact syntax depends on the gateway or OPC server in use. The C-more S7-300 addressing documentation and the TIA Portal indirect-addressing reference provide official guidance.

11. Best Practices for S7-300 Addressing

  1. Reserve address ranges by function. Group all analog inputs in one contiguous block, all analog outputs in another, and digital I/O in a third. This makes symbol-table maintenance predictable.
  2. Always use symbolic names. Bind every absolute address to a symbol in the symbol table. Compile the project to detect unresolved references before downloading to the CPU.
  3. Use peripheral access for high-speed diagnostics. When a value must be sampled faster than the OB1 cycle (e.g., in OB35), use PIW directly. For most applications, OB1 process-image access is faster and more deterministic.
  4. Document address gaps. Note why an 8-channel thermocouple module reserves 16 bytes even when only 4 channels are usable. The documentation prevents confusion during future expansions.
  5. Validate analog ranges in HW Config. Each channel must be configured for the correct measurement type (voltage, current, RTD, TC). A misconfigured channel returns 0x7FFF or 0x8000 immediately.
  6. Avoid floating-point math inside peripheral-access loops. When reading large numbers of PIW in a loop, use integer math and convert to REAL only at the end of the scaling chain.
  7. Reserve process-image space early. The CPU's maximum process image (typically 2048 bytes in/out for CPU 31x) is set in HW Config → CPU Properties → Cycle/Clock Memory. Set this large enough to accommodate future expansions.

Why does my RTD module reserve 16 bytes but only return 8 useful words?

The 6ES7331-7PF01-0AB0 RTD module uses a 24-bit Sigma-Delta converter internally, but the process image is 16 bits per channel (15 bits + sign). HW Config still allocates 2 bytes per channel — 16 bytes total for an 8-channel card — because each channel requires a 16-bit word. There are no internal gaps in this specific module. Gaps appear only on the 6ES7331-7KF02-0AB0 thermocouple module, where 4 of 8 channels are reserved for cold-junction compensation.

Why are my analog inputs returning constant 0x7FFF?

0x7FFF (32767) indicates an open wire or overflow on the analog input. Verify the sensor wiring (especially the 4-wire compensation leads on RTD modules), confirm the channel is configured for the correct sensor type in HW Config, and check that the measurement range matches the physical signal. The diagnostic interrupt OB82 will fire and the channel status byte in the diagnostic data will identify the faulted channel.

How do I read analog inputs faster than the OB1 cycle?

Use peripheral access (PIW) inside a high-priority OB such as OB35 (100 ms cyclic interrupt) or OB40 (hardware interrupt). The peripheral register is read directly from the module without waiting for the OB1 process image refresh. Alternatively, place the analog module inside the OB35 process image in HW Config and use IW instead of PIW for cycle-consistent reads.

What is the difference between Rack 0 starting at IB 0 and Rack 1 starting at IB 32?

Each rack in an S7-300 system has a fixed 32-byte input and 32-byte output address area, regardless of how many slots are populated. Rack 0 occupies IB 0-31, Rack 1 occupies IB 32-63, and so on. Address gaps inside a rack are reserved for future modules — STEP 7 will not reuse them automatically when you insert a new module.

Can I use the same address for a digital input and an analog input?

No. STEP 7 enforces exclusive address assignment within each area (input vs. output are separate). If HW Config detects an overlap, it will refuse to download the configuration and the CPU will report an address assignment error. Each slot's start address must be unique within the entire rack configuration.

Back to blog