Troubleshooting
Why WORD_TO_INT fails on an S7-300 FB instance DB word
Short answer
TIA Portal rejects WORD_TO_INT on %DB1990.DW(28) because DB1990 is that FB's own instance DB: migrated SCL cannot address its own instance data by absolute address. Read the member through its # interface symbol, or, for calculated byte offsets, pass the DB through a BLOCK_DB input and read through that formal parameter.

On this page
After migrating an S7-300 project from STEP 7 V5.5 to TIA Portal V13 SP1, the CONVERT statements stop compiling with an invalid source or assignment error, and the operator is not what is wrong. A line such as #RcpScrCntrl.StCreatedLines := WORD_TO_INT(%DB1990.DW(28)); is rejected because DB1990 is the instance DB of the very FB that contains the line, and TIA Portal's SCL compiler does not let a block address its own instance storage by absolute address. Read the member through its interface symbol instead, and, where the byte offset is calculated at runtime, pass the DB in through an input of type BLOCK_DB and read it through that formal parameter. Both repairs are below, with the offset arithmetic to check before the next download.
What actually fails #
In the STEP 7 V5.5 SCL source the same line compiled cleanly:
RcpScrCntrl.StCreatedLines := WORD_TO_INT(DB1400.DW[(28)]);
After migration the editor shows it rewritten in TIA syntax,
#RcpScrCntrl.StCreatedLines := WORD_TO_INT(%DB1990.DW(28));
and refuses the source. The failure belongs to the migration path itself: these sources compiled in the old editor and stop compiling inside this one FB after the S7-300 STEP 7 v5.5 to TIA Portal migration. Sort the observations before you touch anything:
- The error marks the whole CONVERT statement, because the compiler rejects the source operand handed to it, not
WORD_TO_INTitself. - DB1990 is the instance DB of the FB that contains the line, so the block is reaching into its own storage from inside itself.
- Another DB referenced the same way compiles, so the restriction is limited to self-instance access.
- The offset in this line is a constant; where the offset is calculated at runtime, one symbolic member cannot cover every position, and that case takes the
BLOCK_DBroute below. - Every bracket and spelling variant of the address fails identically, which tells you the conflict is semantic, not syntactic.
Why the instance DB rejects absolute access #
Every call of an FB works against its own instance DB, the data block that stores the interface members and static data of that one call. Inside the FB, the # prefix names a member of the instance now executing: #RcpScrCntrl.StCreatedLines is the declared member, and %DB1990.DW(28) is the same two bytes reached around the interface. The old SCL editor tolerated that reach-around; TIA Portal does not, so the repair is to name what the interface already declares.
The DB number in the migrated error can also surprise you. The original source named DB1400 and the migrated source names DB1990, because both numbers have labelled the same instance storage across the migration; instance DB numbers belong to the project, not to the FB, so read the number at the FB call and keep it out of your code. That per-call ownership is the same rule behind add-on instruction instance tags, where each instance needs its own tag on the Logix platform.
Two compiler rules are worth keeping in mind while you edit: absolute addresses in TIA Portal SCL carry the % prefix, and 64-bit types such as LWORD, LINT and ULINT cannot be addressed absolutely at all.
Fix the fixed offset symbolically #
When the old offset resolves to one declared member, work through this:
-
Open the FB interface and identify the member stored at the old byte position. In the reported project, byte 28 of the instance DB is
RcpScrCntrl.StCreatedLines. -
Check the declared type of that member against the assignment target.
WORD_TO_INTtransfers the 16-bit pattern unchanged, so it reinterprets storage and never scales or range-checks. -
Replace the absolute operand with the interface path:
#RcpScrCntrl.StCreatedLines := WORD_TO_INT(#RcpScrCntrl.StCreatedLines); -
Compile the FB on its own before compiling hardware and the whole project, so a type error inside this block stays separable from unrelated migration errors.
-
Cross-reference the old address once more and confirm nothing else was expected at that byte position.
Symbolic access is the form the compiler can type-check and cross-reference, the same preference behind accessing individual bits within a word variable symbolically.
One caution before you keep the statement at all: it reads the member and writes the converted result back into the same member, a pattern that usually survives from an older type-normalization habit or a reinterpretation the previous compiler permitted. Compare the declared type, the intended meaning and the downstream uses of StCreatedLines first. If the symbolic form compiles but behaves differently from the original intent, correct the member's declared type or add a separate typed temporary rather than forcing an absolute address back in.
Carry calculated offsets through a BLOCK_DB input #
The heavier statement cannot collapse into one fixed member:
WORD_TO_INT(%DB1990.DW((746 + (#RcpScrCntrl.StIndexToZero * 24))))
The base and the stride in that expression are byte offsets and DW selects the 2-byte word sitting at the resulting byte position, so the units already agree and the code steps through the DB at the stride. Because one declared member cannot represent every position the index can select, the repair has two forms.
The better form is structural: declare the repeated region as an array of a PLC data type and index it symbolically, so the compiler checks element type and bounds. Derive the record size and the bounds from the actual DB layout, not from the stride alone — each step can contain padding or several members, and a declaration invented from the stride can map the wrong bytes.
Where the legacy offset arithmetic must stay, move the DB reference out to the FB boundary, which is what the reported fix did:
-
Add an FB input of data type
BLOCK_DB; the reported fix declared the inputDB_1400. -
At each call of the FB, connect the block the old absolute address named — in the reported project that is the FB's own instance DB under its current number. The compiler refuses the block naming itself, and the reported fix shows it accepting the same storage when it arrives as a parameter.
-
Read through the formal parameter instead of naming the instance DB absolutely. The fixed-offset line as wired in that fix reads:
#RcpScrCntrl.StCreatedLines := WORD_TO_INT(#DB_1400.DW(28));and the calculated line follows the same pattern, keeping its arithmetic and swapping the absolute operand for the formal parameter:
#RcpScrCntrl.StCreatedLines := WORD_TO_INT(#DB_1400.DW(746 + (#RcpScrCntrl.StIndexToZero * 24)));
The operand in the code must match the declared input name exactly; keeping the declaration, the operand and the connected block consistent is what prevents wiring one DB and reading another.
Check the offset arithmetic before you trust it #
Indirect addressing moves the checking from the compiler to you, so run the numbers before you accept the migrated line. The byte position of the word is:
746 + StIndexToZero * 24
Worked example: StIndexToZero = 5 gives 746 + 5 × 24 = 746 + 120 = 866, so the statement reads the word spanning bytes 866 and 867 of the DB, and DW(866) and DBW866 name those same two bytes. Because the base and the stride are both even numbers of bytes, every reachable position is even and starts a word on a valid boundary, so alignment can never be the fault in this layout. Length is a different matter: the last byte a word at byte position b uses is b + 1, so b must stay at or below L − 2 for a DB that occupies L bytes, and the largest usable index is the whole-number part of (L − 748) ÷ 24. For an example DB of 1000 bytes that bound works out to (1000 − 748) ÷ 24 = 10.5, so index 10 is the last usable value, its word sitting at byte 986 and spanning 986 and 987, while index 11 would need byte 1010 and has to be clamped or rejected in logic. The 1000-byte length is an example; take the occupied length of the instance DB in your compiled project and apply the same bound.
Tests to run before the next download #
- Compile the FB alone, then the whole project, and download nothing until both pass.
- Round-trip the calculated read: set
StIndexToZeroto 5, write the bit pattern 16#FFFF into the word at byte 866 through a watch table, call the block and check that the INT result reads back −1. The conversion moves the pattern unchanged and 16#FFFF as an INT is −1, so any other value points at a wrong offset or a wrongly connected DB. - Run the largest planned index and one step past it — 10 and 11 against the 1000-byte example — and confirm the past-end call is clamped or rejected rather than read.
- Confirm at the FB call which block feeds the
BLOCK_DBinput, and that it is the block the old code addressed.
One safety note: a wrong byte position does not fault the CPU, the block simply reads the wrong number and hands it to live logic, so keep the download off a running line until the round-trip test has passed on a bench copy.
Questions asked
Why does the error blame WORD_TO_INT when the address is the problem?
The compiler marks the whole CONVERT statement because the source operand it is handed is not accepted in that context, so the operator looks guilty. WORD_TO_INT itself is a documented conversion that transfers the 16-bit pattern unchanged. Keep the operator and change the source: the statement compiles once the operand is the symbolic interface member or a formal parameter of type BLOCK_DB.
Would writing DBW28 instead of DW(28) compile?
No. DW(28) and DBW28 name the same two bytes, so every spelling and bracket variant of the absolute address fails for the same reason. The syntax is tempting because it does compile when the addressed block is a different, declared data block; it fails exactly when that block is the calling FB's own instance DB.
Is absolute DB addressing banned everywhere in TIA Portal SCL?
No. In the reported project, references to any other data block compiled the old way; the rejection was limited to a block naming its own instance DB by number. Keep absolute addresses where they already work on global data, and reserve the symbolic or BLOCK_DB routes for self-instance access.
Why did the address change from DB1400 to DB1990 after migration?
Both numbers label the same instance storage of the block across the migration. An instance DB number is assigned by the project and can change when the DB is regenerated or the program is reorganized, and the absolute reference then follows the new number without warning. The symbolic member does not move with renumbering, which is the second reason to prefer it.
How large can the index in the calculated read be?
The word at the calculated byte position needs two bytes, so with a DB that occupies L bytes the largest usable index is the whole-number part of (L minus 748) divided by 24. For example, a 1000-byte DB allows index 10, whose word occupies bytes 986 and 987, while index 11 would need byte 1010 and must be clamped or rejected in logic. Take L from your compiled DB, not from an example.

