Siemens S7 FC82 BCD Conversion: Resolving Call and Data Errors

David Krause15 min read
S7-300SiemensTroubleshooting
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

Problem Statement: FC82 Call Errors in S7 Programs Migrated from S5

Engineers porting STEP 5 ladder or FBD logic to STEP 7 V5.x on S7-300 or S7-400 controllers commonly rebuild conversion routines through the legacy S5-S7 Converting Blocks library. Block FC82 in that library performs a 16-bit signed binary fixed-point to packed BCD conversion with explicit sign output. When the call is dropped into a freshly created S7 program, two recurring errors block compilation and download:

  • "Illicit transaction / invalid operand for DUAL" — raised by the LAD/FBD/STL editor when the input parameter is wired to a tag whose data type does not match the FC declaration (INT).
  • "Block FC82 not found" / "Description for FC82 not available" — raised at compile time, online consistency check, or by the diagnostic buffer of the CPU when the FC has never been copied into the offline Blocks container of the S7 station.

Both symptoms trace back to the same root issue: FC82 is not a system function (SFC/SFB) inside the S7 CPU firmware; it is a user-supplied FC that resides in the Standard Library container "S5-S7 Converting blocks". Without that library pasted into the offline program and without correctly typed operands, the call cannot be resolved by the editor or the PLC.

S5-to-S7 Block Correspondence

The S5-S7 Converting Blocks library was published by Siemens specifically to ease the migration of arithmetic and conversion routines from S5 to S7-300/400. Each S5 standard FB maps to a single S7 FC with identical parameter naming and semantics:

S5 Block S5 Function S7 Block (FC) Container in STEP 7 V5.x
FB241 16-bit signed binary → BCD with sign FC82 S5-S7 Converting blocks
FB242 BCD → 16-bit signed binary FC83 S5-S7 Converting blocks
FB243 32-bit signed binary → BCD with sign FC84 S5-S7 Converting blocks
FB244 BCD → 32-bit signed binary FC85 S5-S7 Converting blocks
FB245 16-bit BCD → 16-bit binary FC86 S5-S7 Converting blocks
FB246 16-bit binary → 16-bit BCD (no sign) FC87 S5-S7 Converting blocks
Note: The S5-S7 Converting Blocks library is a STEP 7 PC-side library, not part of the S7 CPU firmware. Each FC must be copied into the offline Blocks container of the S7 station. Calling FC82 without first pasting the library results in "Unknown block" errors at both compile time and at online download.

FC82 Interface Specification

FC82 declares four parameters with fixed data types. Passing the wrong type to any IN parameter triggers compile errors; passing the wrong type to OUT corrupts the conversion result.

Parameter Direction Declared Type Width Description
DUAL INPUT INT 16 bits Signed binary fixed-point source value to convert
SBCD INPUT BOOL 1 bit Sign control / sign-marker bit for the BCD output
BCD2 OUTPUT BYTE 8 bits BCD result low / sign-marker byte
BCD1 OUTPUT WORD 16 bits BCD result word (high-order packed digits)

The call shown by the user is the canonical S7 syntax for FC82:

CALL FC 82
  ( DUAL := DBW 200
  , SBCD := M 11.0
  , BCD2 := DBB 210
  , BCD1 := DBW 212
  );

Every operand must match the parameter declaration exactly:

  • DBW 200 must be declared as INT in the data block.
  • M 11.0 must be a BOOL flag bit (default for merker bits in S7-300/400).
  • DBB 210 must be a BYTE element at absolute offset 210.0 of its DB.
  • DBW 212 must be a WORD element at absolute offset 212.0 of its DB (WORD is preferred over INT for BCD storage because the bit pattern is not a signed integer).

Root Cause 1: Library Not Inserted in the S7 Project

The dominant cause of "introuvable description pour FC82" / "FC82 not found" is that the FC has never been copied into the offline Blocks container of the S7 station. Although STEP 7 installs the library on the engineering PC, it does not automatically include it in new S7 projects. Symptom patterns:

  • SIMATIC Manager reports "The block is not available in the S7 program".
  • The S7 program editor displays FC82 highlighted in red inside the network.
  • Download to the PLC fails with diagnostic buffer entry "Unknown function / OB not loaded".
  • Online view of the CPU shows FC82 absent from the System Data and Program block list.
  • F1 help on the highlighted FC82 returns no topic.

Root Cause 2: Data Type Mismatch on the DUAL Operand

The "illicit transaction for DUAL" / "Invalid data type for parameter DUAL" error is raised whenever a non-INT operand is wired to the input. Common causes seen in field-deployed projects:

  • DBW 200 declared as WORD instead of INT in the DB source.
  • DBW 200 declared as DWORD (32-bit) because the upstream arithmetic promoted the tag to 32-bit precision.
  • DBW 200 declared as REAL (floating-point) because a previous conversion block reused the symbol.
  • DBW 200 mapped to a STRUCT field whose type does not match INT.
  • Use of absolute addresses that were never declared in the symbol table or DB source — the editor treats them as undefined.

When the editor encounters the type conflict, it either refuses to compile the network (offline) or replaces the operand with a "?" placeholder that is downloaded to the PLC as an error marker.

Diagnostic Procedure

Before applying the fix, isolate which of the two errors is active. Both can coexist; clearing one often reveals the other.

  1. Open the offending FC, FB, or OB that contains the CALL FC 82 statement (LAD/FBD/STL editor).
  2. Click on FC82 inside the network and press F1. If the integrated help cannot locate a description, the library has not been inserted.
  3. Inspect the colour of each operand in the network: red text = unresolved block reference; blue italics with "?" = type error.
  4. In SIMATIC Manager, expand the S7 program → Blocks container and verify whether FC82 is listed. If absent, the S5-S7 Converting Blocks library has not been inserted.
  5. Open the data block that owns DBW 200 and switch to Declaration View. Confirm that the element at offset 200.0 is declared as INT (not WORD, DWORD, REAL, BOOL, BYTE).
  6. Cross-check M 11.0 (BOOL), DBB 210 (BYTE), and DBW 212 (WORD) declarations in the same DB or symbol table.
  7. Compile the program (Menu → PLC → Compile and Check Block Consistency / Compile All). The compile log lists every type mismatch and unresolved symbol.
  8. Read the CPU diagnostic buffer (PLC → Diagnostic/Setting → Module Information → Diagnostic Buffer) for entries such as "Stop by unknown function" or "Block not available".

Resolution: Step-by-Step Procedure

Step 1 — Insert the S5-S7 Converting Blocks Library

  1. In SIMATIC Manager, open the S7 project.
  2. Menu: File → Open → Libraries → Standard Library.
  3. Open the container named S5-S7 Converting blocks.
  4. Locate FC82 in the right-hand block list. Right-click → Copy.
  5. Navigate to the target S7 program → Blocks folder of the active station (e.g., SIMATIC 300 Station → CPU → S7 Program → Blocks).
  6. Right-click → Paste. Confirm the overwrite prompt only if FC82 already exists with different content from a different library revision.
  7. Save and recompile the project.

The library FCs are version-pinned to the STEP 7 release. If you migrate between STEP 7 V5.x service packs, re-paste the FC from the new installation to inherit any internal corrections.

Step 2 — Correct the DB Data Type

  1. Open the data block containing DBW 200 in DATA VIEW.
  2. Switch to DECLARATION VIEW.
  3. Locate the symbol that maps to DBW 200 (or the address offset 200.0).
  4. Change the data type from WORD, DWORD, REAL, or BYTE to INT.
  5. Save the DB (Ctrl+S) and acknowledge the "Type change — initialize again?" prompt only if downstream logic tolerates a re-initialization of actual values.
  6. Recompile and re-download the DB.

Step 3 — Verify the Remaining Operands

  1. M 11.0 must be a BOOL bit of merker byte MB11. Merker bytes default to BOOL-by-bit in S7-300/400, so M 11.0 is almost always valid unless it was redeclared as part of a custom data type elsewhere.
  2. DBB 210 must be a BYTE element; if a previous block wrote it as part of a larger STRUCT, ensure the absolute offset 210.0 maps to a BYTE element and is not overlapped with adjacent fields.
  3. DBW 212 must be a WORD element. Although INT also occupies 16 bits, FC82 expects the destination to be interpreted as packed BCD, so WORD is the conventional and safest choice.

Step 4 — Compile, Download, and Test

  1. Compile the entire S7 program: PLC → Compile All (or right-click the Blocks folder → Compile).
  2. Download the blocks to the CPU: PLC → Download. Choose "Download to target device" and select the online interface.
  3. Open the instance DB online (right-click the DB → Monitor/Modify) and watch DBW 200 (input) and DBW 212 / DBB 210 (output) live.
  4. Force a known INT value into DBW 200 from a VAT (Variable Table) and verify that BCD1/BCD2 reflect the correct packed BCD digits and sign marker.
  5. Toggle the STOP/RUN switch on the CPU if necessary to bring the new block set into effect.

Verification Checklist

Check Expected Result
FC82 present in offline Blocks container Yes, with timestamp matching the library paste operation
F1 help on FC82 opens a topic Help page displays parameter table and description
Network containing CALL FC82 No red text, no "?" placeholders
DBW 200 declaration INT in declaration view, offset 200.0
M 11.0 declaration BOOL flag bit
DBB 210 declaration BYTE
DBW 212 declaration WORD
Compile result 0 errors, 0 warnings
Online block list on CPU FC82 visible under Program blocks
CPU diagnostic buffer No "Unknown function" entries
Functional test with INT input 1234 BCD1 = 16#1234 (or equivalent packed digits), BCD2 sign byte correct

Parameter Semantics Deep Dive

DUAL — Signed 16-bit Input

The DUAL operand is read as a 16-bit signed integer in two's-complement representation. The valid numeric range is −32768 to +32767, but because the BCD output holds at most four decimal digits, the practical conversion range is −9999 to +9999. Values outside that range may produce BCD patterns that overflow the destination and trigger ENO = 0 (or set the BR bit low), which should be evaluated by the calling logic if overflow detection is required.

SBCD — Sign Control Bit

SBCD selects whether and how the sign is reflected in the BCD output byte (BCD2). Wiring SBCD = FALSE (0) suppresses the explicit sign marker; SBCD = TRUE (1) encodes the sign of DUAL into BCD2. This behaviour mirrors the original S5 FB241 semantics, where the sign byte was always generated and SBCD acted as a write-enable rather than a sign selection.

BCD2 — Sign / Low BCD Byte

BCD2 stores the sign marker. Common encodings used by FC82:

  • 16#00 — positive value (or sign-marker disabled).
  • 16#FF — negative value (or sign-marker enabled with negative source).

The exact byte pattern depends on the STEP 7 library revision. Always verify the encoding by forcing a known signed value and reading BCD2 online.

BCD1 — Packed BCD Digit Word

BCD1 receives the four packed BCD digits of the absolute value. Each nibble (4 bits) carries one decimal digit; the resulting word holds up to 9999 (16#9999). For values exceeding 9999, BCD1 is set to 16#0000 and the BR bit of the FC is reset to indicate overflow.

Native S7 Alternatives to FC82

If maintaining the legacy S5-S7 conversion library is undesirable (for example, when consolidating code on TIA Portal or when migrating to S7-1500), the same functionality can be built natively in S7-300/400 with no external library dependency.

For a 16-bit signed INT → BCD conversion, the canonical approach uses the STL accumulator instruction ITB (Integer to BCD):

// STL implementation (S7-300/400)
L     DBW 200           // Load signed INT source
ABS                     // Take absolute value, status bit CC1 set
ITB                     // INT to BCD (16-bit) - ACCU1-L holds 4 BCD digits
T     DBW 212           // Store packed BCD into BCD1 destination

A     DBW 200           // Test bit 15 of source (sign bit)
JCN   POSI              // Jump if RLO=0 (positive)
L     B#16#FF           // Negative: load sign marker
T     DBB 210           // Store into BCD2
JU    END
POSI: L     B#16#00     // Positive: load zero
T     DBB 210
END:  NOP   0

The ITB instruction converts the accumulator low word (16-bit INT) to packed BCD (four BCD digits in bits 0–15). Combined with explicit sign evaluation via the source word's bit 15, you obtain the same output layout as FC82 without external library calls. For 32-bit conversions, the corresponding instruction is DTB (DINT to BCD), which produces 8 BCD digits in accumulator 1 and requires the source to be in DINT range.

Always bracket ITB / DTB with an overflow check (the OV bit is set if the source exceeds the BCD representable range):

L     DBW 200
ITB
JO    OVER              // Branch if overflow
T     DBW 212           // Store only if no overflow

Library Reference and Migration Notes

The S5-S7 Converting Blocks library is documented in the STEP 7 V5.x Standard Library reference manual. Refer to the Siemens Industry Online Support portal for the current revision of the conversion block set and the corresponding STEP 7 service pack compatibility matrix:

For S7-1200 and S7-1500 controllers (TIA Portal), the S5-S7 Converting Blocks library is not distributed. Conversion must be implemented using the native instructions ITB, DTB, BCD_I, I_BCD, or the IEC 61131-3 standard functions. Porting FC82-based logic to S7-1200/1500 requires rewriting the call as a user-defined FB with matching interface (DUAL: INT, SBCD: BOOL, BCD2: BYTE, BCD1: WORD).

Troubleshooting Matrix

Symptom Likely Root Cause Fix
"FC82 not found" / "Unknown block" Library not inserted in S7 program Paste FC82 from S5-S7 Converting blocks library into the offline Blocks folder
"Invalid operand for DUAL" DBW 200 declared as non-INT (WORD, DWORD, REAL, BYTE) Change DB element to INT in declaration view
Compile warns about parameter type SBCD wired to BYTE/WORD instead of BOOL Wire a BOOL flag bit (e.g., M 11.0)
Output BCD1/BCD2 always zero Input out of range (> 9999 or < -9999) or sign path not handled Check input limits; verify BCD2 sign marker logic
Online "Block not available" on CPU Download incomplete or FC82 not in offline blocks Re-download entire program with FC82 included
F1 help on FC82 shows nothing STEP 7 installation missing documentation Reinstall STEP 7 with documentation option enabled
CPU goes to STOP after download Diagnostic buffer "Unknown function called" Paste FC82 into Blocks folder and re-download
BF / SF LED on CPU lights intermittently Type mismatch on input causes OB121 time error Correct DB element type to INT
BCD1 contains 16#0000 on valid input Sign handling inverted or source negative without ABS Pre-process with ABS or verify SBCD polarity

Field-Proven Commissioning Notes

  • When migrating S5 projects that call FB241 dozens of times, paste the entire S5-S7 Converting Blocks library at once (File → Open → Libraries → Standard Library → S5-S7 Converting blocks → select all → Copy → Paste into Blocks folder). This eliminates per-call resolution errors.
  • Maintain a project-specific "legacy library" backup folder with the FC82 / FC83 / FC84 / FC85 blocks so that re-import after a STEP 7 reinstall is a one-step operation.
  • If you change a DB element from WORD to INT to satisfy FC82, audit all other consumers of that symbol. A WORD→INT change is type-incompatible and any FC/FB that expected a 16-bit bit pattern will now treat bit 15 as the sign bit.
  • Place a VAT on DBW 200, M 11.0, DBB 210, and DBW 212 to monitor the conversion online. Force known signed integers (+123, −456, 9999, −9999) and verify that BCD1 and BCD2 match the expected packed pattern.
  • For new projects targeting S7-1500 or S7-1200, do not introduce FC82 dependencies. Use ITB / DTB instructions or create a project-specific FB with a clean IEC 61131-3 interface.
  • If the CPU firmware is older than V2.x on S7-300, confirm that the conversion library blocks compiled against your STEP 7 service pack are compatible with the CPU's firmware. Mismatched revisions can produce "Block invalid" or "Block not executable" entries in the diagnostic buffer.

Summary of Fix Path

  1. Open File → Open → Libraries → Standard Library → S5-S7 Converting blocks and copy FC82 into the offline Blocks container.
  2. Open the DB that owns DUAL (DBW 200) and confirm it is declared as INT.
  3. Verify that SBCD (M 11.0) is BOOL, BCD2 (DBB 210) is BYTE, BCD1 (DBW 212) is WORD.
  4. Compile the program, download to the CPU, and force a known INT test value to verify the BCD output.
  5. Optionally, replace FC82 with native ITB / DTB instructions for long-term maintainability.

What does FC82 do in the S5-S7 Converting Blocks library?

FC82 converts a 16-bit signed binary fixed-point integer (DUAL, INT) to a packed BCD representation with explicit sign output. The sign marker is written to BCD2 (BYTE) and the BCD digits to BCD1 (WORD). It mirrors S5 FB241 for migration compatibility.

Why does the compiler report "FC82 not found" even though I copied the call from a working S5 program?

FC82 is not part of the S7 CPU firmware or the standard STEP 7 system blocks. It is a library FC that must be copied from "Standard Library → S5-S7 Converting blocks" into the offline Blocks container of your S7 program before the call can be resolved.

How do I fix the "invalid operand for DUAL" error?

Open the data block that owns the DUAL operand (e.g., DBW 200) in declaration view and confirm the element is declared as INT (16-bit signed). Change WORD, DWORD, REAL, or BYTE declarations to INT, recompile, and re-download.

Can I use FC82 on S7-1200 or S7-1500 controllers?

No. The S5-S7 Converting Blocks library is supplied only for STEP 7 V5.x targeting S7-300/400. On S7-1200/1500 (TIA Portal) use the native instructions ITB (INT to BCD) and DTB (DINT to BCD), or write a user FB that replicates the FC82 output layout (BCD2 sign byte, BCD1 packed digits).

What is the equivalent S5 block for FC82?

FC82 in the S7 library corresponds to FB241 in the S5 standard function block set. The S5-S7 Converting Blocks library preserves the parameter names (DUAL, SBCD, BCD2, BCD1) and the calling convention so S5 ladder logic can be ported with minimal rewiring.

Back to blog