PLCcheck

S5 to S7 Data Block Address Mapping: DW → DBW (×2 Rule)

Critical S5 to S7 data block address conversion. The DW×2 rule: S5 DW n becomes S7 DBW (n×2). Complete conversion table with bit-level mapping. The #1 source of migration errors.

·6 min read
S5S7data blockDBDWDBWaddressmappingconversionx2 rulebit mapping

Diesen Artikel auf Deutsch lesen

S5 to S7 Data Block Address Mapping: DW → DBW (×2 Rule)

This is the most error-prone address conversion in S5→S7 migration. S5 addresses data block words by word number (DW 0, DW 1, DW 2). S7 addresses by byte offset (DBW 0, DBW 2, DBW 4). Since each word is 2 bytes, the conversion rule is: S7 byte address = S5 word number × 2.

The ×2 Rule

S7 DBW address = S5 DW number × 2

Word Conversion Table

S5 AWLS7 STLCalculationDescription
DW 0DBW 00 × 2 = 0First word
DW 1DBW 21 × 2 = 2Second word
DW 2DBW 42 × 2 = 4Third word
DW 3DBW 63 × 2 = 6Fourth word
DW 4DBW 84 × 2 = 8Fifth word
DW 5DBW 105 × 2 = 10
DW 8DBW 168 × 2 = 16
DW 10DBW 2010 × 2 = 20
DW 15DBW 3015 × 2 = 30
DW 20DBW 4020 × 2 = 40
DW 50DBW 10050 × 2 = 100
DW 100DBW 200100 × 2 = 200
DW 255DBW 510255 × 2 = 510

Double Word (DD → DBD)

S5 AWLS7 STLCalculation
DD 0DBD 00 × 2 = 0
DD 1DBD 21 × 2 = 2
DD 2DBD 42 × 2 = 4
DD 4DBD 84 × 2 = 8

Note: DD in S5 accesses 4 bytes starting at word n. DD 0 = DW 0 + DW 1. In S7, DBD 0 = DBW 0 + DBW 2 = bytes 0–3. Same data, different numbering.

Byte Access (DL/DR → DBB)

S5 uses DL (left byte = high byte) and DR (right byte = low byte) within a word:

S5 AWLS7 STLDescription
DL 0DBB 0High byte of DW 0
DR 0DBB 1Low byte of DW 0
DL 1DBB 2High byte of DW 1
DR 1DBB 3Low byte of DW 1
DL nDBB (n×2)High byte of DW n
DR nDBB (n×2 + 1)Low byte of DW n

Bit Access (D x.y → DBX)

S5 bit access within data blocks uses D word.bit:

S5 AWLS7 STLCalculation
D 0.0DBX 1.0Word 0, bit 0 → byte 1, bit 0
D 0.7DBX 1.7Word 0, bit 7 → byte 1, bit 7
D 0.8DBX 0.0Word 0, bit 8 → byte 0, bit 0
D 0.15DBX 0.7Word 0, bit 15 → byte 0, bit 7
D 1.0DBX 3.0Word 1, bit 0 → byte 3, bit 0
D 1.8DBX 2.0Word 1, bit 8 → byte 2, bit 0
D 25.3DBX 51.3Word 25, bit 3 → byte 51, bit 3
D 25.8DBX 50.0Word 25, bit 8 → byte 50, bit 0

Bit mapping formula:

DB Access Syntax

S5 AWLS7 STLDescription
A DB 10OPN DB 10Open data block 10
L DW 5L DBW 10Load word 5 (after A DB) → byte 10
L DB10.DW5L DB10.DBW10Direct access (no A DB needed in S7)

S7 advantage: In S7, you can access DB10.DBW10 directly without opening the DB first. In S5, A DB 10 must precede data access.

This Is the #1 Migration Error

Forgetting the ×2 conversion causes the program to read/write wrong data. The program compiles without errors — the addresses are syntactically valid. But the data is shifted by half, causing unpredictable behavior.

Example of the error:

Use our free S5→S7 Address Converter to verify any conversion.


Part of the S5→S7 Address Mapping Reference. Maintained by PLCcheck.ai.

Related Articles

Analyze your PLC code with AI

PLCcheck Pro explains, documents, optimizes, and migrates PLC code — automatically.

Try PLCcheck Pro →
← Back to Blog

Not affiliated with Siemens AG. S5, S7, STEP 5, STEP 7, and TIA Portal are trademarks of Siemens AG.