Documenting Siemens S7 PLC Programs DOCPRO, S7-Graph Best

David Krause14 min read
Best PracticesS7-300Siemens
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

Overview: Why Program Documentation Is a Deliverable, Not an Afterthought

Siemens SIMATIC S7-300/400 and S7-1500 PLCs are programmed in three of the four languages defined by IEC 61131-3: Ladder (LAD), Statement List (STL), and Structured Control Language (SCL). The fourth, Sequential Function Chart (SFC) - implemented in Siemens tools as S7-Graph - is itself a graphical documentation of state transitions. The default programming environment, SIMATIC Manager (Step 7 V5.x) or TIA Portal, stores the source of truth in machine-readable blocks (OB, FB, FC, DB, UDT), but the printed, human-readable form is what electricians, maintenance technicians, process engineers, and auditors actually consume.

The field reality: a compressor skid program in STL that ran for 14 years without complaint becomes incomprehensible the day a process engineer who never saw the code is asked to add a permissives interlock. Documentation closes that gap. This reference covers the toolchain (DOCPRO V5.4, S7-Graph, TIA Portal printout functions), the conventions (naming, symbol tables, network comments, structured programming), and the verification steps that turn undocumented logic into an inspectable deliverable.

A program without symbol comments, network titles, and a printed cross-reference is not "working code" - it is a liability sitting on a CF card. Treat the documentation printout as a controlled artifact with a revision number, date, and approver, the same as the PLC source it describes.

Tool Selection Matrix for S7-300/400 Documentation

Siemens offers three primary documentation paths. Each fits a different audience and program style.

Tool Target Platform Source Languages Output Best Audience
DOCPRO V5.4 (optional package, 6ES7802-0BC04-0YA0) SIMATIC S7-300, S7-400, C7 LAD, FBD, STL, SCL, S7-Graph Wiring manuals, plant documentation, unified print image (PDF/printable) Maintenance, panel builders, EPC documentation packages
S7-Graph V5.3+ (6ES7811-0CC06-0YA0) S7-300, S7-400 SFC (sequential) State/transition diagram, online monitoring view Process engineers, sequential machine builders
TIA Portal Print / Documentation Editor S7-1200, S7-1500, S7-300/400 (via portal) LAD, FBD, STL, SCL, GRAPH (S7-1500) Program printout, project tree, cross-reference, PLC tag table Any audience on a modern TIA Portal project

DOCPRO V5.4 is the canonical documentation package for legacy S7-300/400 plants. It extracts the symbol table, the program structure (OB/FB/FC/DB hierarchy), the cross-reference, and the network comments, then renders them into a project-defined layout. The printout uses a configurable title page, page header (project name, plant designation, document number), and page footer (page n of m, date, generated by). For multi-cabinet panels, DOCPRO can stitch together wiring lists across multiple stations and produce a single plant document.

Structured Programming: FC/FB Division of Labor

Documentation scales with the program only if the program itself is structured. The single most common cause of unreadable S7 code is the "one giant OB1" pattern, where all logic is dumped into cyclic OB1 with shared flags. Replace it with the following hierarchy:

Block Type Purpose Naming Prefix (recommended) Documentation Surface
OB (Organization Block) Cyclic, startup, time-of-day, error, hardware interrupt OB1_CYC, OB100_STARTUP, OB82_DIAG Block comment only; OB1 should contain FC calls, no logic
FC (Function) Reusable logic with stateless I/O; one FC per unit operation or device FC_Valve_Open, FC_Motor_Start Block header: I/O list, version, author; every network commented
FB (Function Block) Stateful logic with instance DB; one FB per equipment class FB_Pump, FB_Heater Multi-instance capability, parameter interface documentation
DB (Data Block) Instance DBs, global DBs, UDT-based data DB_Pump_Instance, DB_Recipe Each variable commented; UDT used for repeating structures
UDT (User-Defined Type) Reusable data structure UDT_Motor_Data, UDT_Valve_Status Single source of truth for the structure

OB1 should read as a table of contents:


Network 1:   // --- Inputs acquisition ---
            CALL  FC_Read_DI
            CALL  FC_Read_AI

Network 2:   // --- Mode selection ---
            CALL  FC_Mode_Selector

Network 3:   // --- Sequential control ---
            CALL  FB_Batch_Sequencer    DB_Batch

A maintenance technician who does not know STL can read this and immediately understand the program shape. That is the goal.

Symbol and Tag Naming Conventions

Siemens S7 supports two parallel naming spaces: the absolute address (I 0.0, MW100, DB10.DBD0) and the symbolic name. The symbol table is the bridge between the two, and it is the first document a non-programmer will read. Adopt a strict prefix scheme and apply it to every entry in the symbol table before the first FB is written.

Prefix Meaning Example
DI_ Digital input (sensor, pushbutton, limit switch) DI_PressureSwitch_PSH_101
DO_ Digital output (contactor coil, solenoid, indicator) DO_Valve_V201_Open
AI_ Analog input (transmitter, RTD, TC module) AI_PressureTransmitter_PT_364
AO_ Analog output (VFD reference, valve positioner) AO_FlowController_FCV_220
FC_ Function (stateless) FC_Valve_Open, FC_Interlock_Permissive
FB_ Function block (stateful) FB_Pump, FB_Heater, FB_Batch_Seq
DB_ Data block DB_Pump_001_Inst, DB_Recipe_Active
UDT_ User-defined type UDT_Motor_Standard, UDT_Valve_3way
MEM_ Internal flag (M area) MEM_Batch_Running, MEM_Fault_Latched
TMR_ IEC timer instance TMR_Drain_Delay, TMR_Start_Permit
CTR_ IEC counter instance CTR_Batch_Count, CTR_Reject_Tally

Avoid raw M-bits and unnamed FCs. A program with 30% symbolic names and 70% absolute addresses cannot be documented, because the printout will show MW 102 instead of MEM_Batch_Running. Enforce the naming scheme at the symbol table, not in code.

Network Titles and Comments: The Non-Programmer's Reading Path

A network title is the single line of text that appears above each LAD/FBD/STL network. Treat it as a sentence, not a fragment.

Style Example Reads as
Bad (verb fragment) // Open valve Ambiguous - open under what conditions?
Good (condition + action + result) // IF auto mode AND permissive OK THEN energize V201 open coil with 3 s seal-in delay Complete intent, references device tag, references mode
Better (state machine step) // Step 30: Drain pump stopped, vent valve open - wait 5 s then advance Maps to a named state, no ambiguity

Block comments go in the Block Properties dialog (Author, Family, Title, Version, Comment). The Comment field is where you store the function description in plain English; it appears on the printout header. The Title field is a 24-character or so summary used in the cross-reference list. The Version field is critical: increment it on every functional change. A printout dated 2018 with Version 1.4 cannot be reconciled with the live PLC if the current source is Version 2.1, and that is the question the auditor will ask.

S7-Graph: Documentation as the Program Itself

For sequential processes - batch recipes, machine cycles, conveyor routing - S7-Graph is the documentation tool that doubles as the programming language. The SFC view shows steps (rectangles) and transitions (small bars with conditions). Each step has a defined action set (N, S, R, D, CALL) and each transition has a Boolean condition expressed in LAD, FBD, or STL.

The S7-Graph online monitor in the SFC view shows the active step highlighted and the satisfied conditions highlighted in green, which is what the field engineer wants when watching a stalled machine. The printout shows the full sequence in graphical form. The documentation trade-off:

  • Pro: The SFC is a flow chart. Non-programmers can read the sequence. Online monitoring is intuitive.
  • Pro: Steps and transitions have dedicated comment fields, so each state change can be described in plain language.
  • Con: S7-Graph is licensed separately. On S7-300/400 it is option package 6ES7811-0CC06-0YA0 (or successor). It only makes sense for sequential logic; continuous control belongs in PID blocks.
  • Con: Documentation of parallel and alternative branches is rich in S7-Graph but the print layout is less flexible than DOCPRO. Hand-edit the SFC printout header to add the title page.

Use S7-Graph for state machines, not for everything. A pump start/stop that has 6 permissives and one timer is better as a structured-text FB with a UDT; turning it into a 1-step S7-Graph chain is over-engineering and hurts readability.

DOCPRO V5.4 Configuration and Output

DOCPRO is invoked from SIMATIC Manager via Options > SIMATIC Documentation > DOCPRO. The configuration steps:

  1. Create a documentation project. In DOCPRO, define a new project. The project becomes a container for one or more print jobs.
  2. Select the S7 program(s) to document. Add the S7-300 or S7-400 station(s). DOCPRO will pull the symbol table, the block folder, and the system data from the offline project.
  3. Configure the job structure. A DOCPRO job is a sequenced list of sections. Typical sections in order: Cover page, Table of contents, Plant/Project overview, Symbol table, Block list, Cross-reference, Program printout (per FC/FB), Wiring list, Index.
  4. Select the layout. DOCPRO ships with several default layouts. For multi-volume plants, define a custom layout with the project number in the page header and the document ID in the footer.
  5. Define cover page fields. Plant designation, document number, revision, date, preparer, approver. These map to the project's automation header (BSK/ATV standard). Lock the fields once the cover is approved.
  6. Generate. Output to a printer queue or to PDF via the print driver. Verify pagination and font rendering - field experience shows that some Siemens logos and special characters break under non-Western Windows locale settings.

DOCPRO does not convert STL to flow charts. The program printout is a textual rendering of the source. If the requirement is a graphical flow chart, that has to be drawn separately, typically in Visio, AutoCAD Electrical, or draw.io, against the printed STL as the source of truth.

TIA Portal Printout and Cross-Reference

For TIA Portal projects (S7-1200, S7-1500, and S7-300/400 imported as V15+ portal projects), the printout function replaces DOCPRO for most day-to-day work. The printout is generated from Project tree > Print. Configure the printout to include:

  • Project tree (folder/block structure)
  • PLC tag table (the modern symbol table) with comments
  • Block list with block properties (Author, Title, Version, Family, Comment)
  • Block code (LAD/FBD/STL/SCL/GRAPH) with network comments
  • Cross-reference (Tools > Cross-reference) showing each tag's use site (read/write/inout) and its network location
  • Watch tables and force tables in their current state (audit; do not leave forced values in production)
  • Hardware configuration: device list, slot assignment, module order numbers, firmware versions, IP/profinet device names

The cross-reference is the single most valuable document for the non-programmer. A maintenance engineer asked "what writes to MEM_Auto_Mode_Latched?" can answer the question in five seconds with a sorted cross-reference printout. Generate it after every functional change and store the printout alongside the project archive.

Flow Chart Generation: What Works and What Doesn't

Siemens does not provide a tool to auto-convert STL, SCL, or LAD into flow charts. The community has tried several approaches; the realistic options are:

Method Input Output Practical Use
Manual flow chart drawn against the printed source STL/LAD/SCL printout Visio, AutoCAD Electrical, draw.io, yEd Most common; treats the chart as a separate deliverable owned by documentation
S7-Graph online view exported as graphic S7-Graph FB SFC image Excellent for sequential logic; not applicable to non-sequential code
CFC (Continuous Function Chart) editor LAD/FBD code Block-and-line diagram Useful for analog/PID loops; sold as optional package (CFC V9.0+, 6ES7658-1FX06-0YA0 family for PCS 7)
Reverse-engineering tools (third-party) S7 project archive Various Vendor-dependent; not free; check for current SIMATIC version support

For a brownfield retrofit where the customer wants a flow chart and the code is 2000 lines of STL, the realistic deliverable is a 1-2 page top-level flow chart that names each FC and shows the data flow between them, plus a printout of each FC in source form. Do not promise a fully expanded flow chart of the STL - it is not feasible in budget.

Documentation Verification Checklist

Before signing off a documentation deliverable, run the following matrix against the project. Each row is a check, the column indicates the evidence required.

Check Evidence Pass Criteria
Symbol table 100% populated Export of symbol table to CSV Zero entries with empty symbol column on used addresses
Every network has a title Block printout scan No empty network title fields in the printout
Block comment present Block properties export Comment field non-empty for every OB, FB, FC, DB
Block version incremented and dated Block properties export Version > 0; date matches last change
Cross-reference generated and reviewed Cross-reference printout Each tag has a documented use; no orphaned tags
OB1 contains FC/FB calls only, no inline logic OB1 printout OB1 network count is small (typically <20) and each network is a CALL
Hardware configuration printed HW Config printout / TIA device view Module order numbers, slot positions, IP addresses, PROFINET device names present
Printout matches live PLC Online/offline comparison Compare the offline project archive to the connected PLC; no differences, or all differences documented as approved
Cover page fields complete DOCPRO cover / TIA printout header Plant, project number, document number, revision, date, preparer, approver all populated
Change log present Project revision history or external changelog Each functional change has an entry with author, date, description, reason

Field-Proven Pitfalls

The following are failure modes that field engineers have flagged repeatedly. Treat them as design-time red flags, not post-hoc surprises.

  • Markers (M area) used in place of symbols. A program with 200 M-bits and 20% symbol coverage is the #1 documentation failure. Every M-bit must have a symbolic name in the symbol table and a comment that explains its purpose.
  • OB1 with 80 networks of inline logic. The printout will be unreadable. Restructure into FCs before documenting, or the document will describe an unmaintainable program.
  • No version field on blocks. When the next programmer asks "is this the same code that was running in 2019?" the only honest answer is to compare block checksums via online/offline compare and the version metadata.
  • DOCPRO cover page out of sync with the program. The cover lists the document number, but the symbol table and program printout were regenerated two revisions later. Lock the cover after regeneration, or set a build script that ties the two together.
  • Symbol table comments truncated. The S7 symbol table allows up to 80 characters per symbol and 80 characters per comment. Long device tags get clipped, and the printout shows "AI_PressureTransmitter_PT364" without a unit or range comment. Add the range and units in the comment: // 0-10 bar, 4-20 mA, scale in FC101.
  • Forced values left in the printout. A watch table screenshot that includes a forced bit will mislead a future reader into believing it is a normal condition. Clear all forces before the screenshot, and document force operations in a separate log.
  • S7-Graph used for non-sequential logic. A PID loop or a continuous process control does not benefit from S7-Graph; the printout becomes a one-step chain with no value added. Reserve S7-Graph for state machines with discrete steps.
  • No online/offline verification before generating the printout. A common mistake is to document the offline project without checking that the offline matches the live PLC. Always run an online/offline compare and resolve all differences (or document the approved deviations) before generating the document.

Recommended Documentation Stack by Project Phase

Phase Primary Tool Output Audience
Code authoring SIMATIC Manager / TIA Portal, symbol table, block comments Live source with comments Developers
Internal review Block printout (PDF), cross-reference PDF deliverables for code review Lead engineer, peer review
Commissioning Online monitoring, watch tables Live + screenshot evidence per FAT/SAT step Commissioning team, customer
Customer handover DOCPRO V5.4 (legacy) or TIA Portal printout (modern) Bound or PDF plant documentation package Customer's maintenance and operations
Long-term support Cross-reference + symbol table + block printout + change log Living documentation updated on every change Service team, future projects

The single most important habit: regenerate the documentation at every functional change. A program that is "in the field, working, documented once in 2017" is, in 2026, a program that no one can modify safely. Documentation is not a milestone; it is a continuous artifact.

FAQ

Does Siemens offer a tool to auto-convert LAD, STL, or SCL into a flow chart?

No. Siemens does not ship an STL/SCL/LAD-to-flow-chart converter. DOCPRO V5.4 produces a textual printout of the source; the program printout is the source of truth, and a flow chart, if required, must be drawn manually against that printout using Visio, AutoCAD Electrical, or a similar tool. S7-Graph is the only Siemens tool where the graphical view (the SFC) and the executable code are the same artifact.

What is the difference between DOCPRO V5.4 and the TIA Portal printout function?

DOCPRO V5.4 (option package 6ES7802-0BC04-0YA0) is a dedicated documentation generator for SIMATIC S7-300, S7-400, and C7 projects in SIMATIC Manager. It supports a configurable cover page, multi-station wiring lists, and a unified plant-wide layout. The TIA Portal printout function is built into TIA Portal itself and works for S7-1200, S7-1500, and TIA-portal-resident S7-300/400 projects. For new projects, use the TIA Portal printout; for legacy S7-300/400 plants that have not been ported, DOCPRO remains the standard.

Should I use S7-Graph for every program to make it easier to document?

No. S7-Graph (option package 6ES7811-0CC06-0YA0) is designed for sequential processes with discrete steps and clear transitions - batch recipes, machine cycles, conveyor routing. For continuous control, PID loops, or simple start/stop logic, S7-Graph adds overhead without readability benefit. Use it where the program shape is naturally a state machine, and use structured FBs with UDTs and well-commented networks for everything else.

What naming convention should I use for the symbol table?

Adopt a strict prefix scheme: DI_, DO_, AI_, AO_ for I/O; FC_, FB_, DB_, UDT_ for blocks; MEM_ for internal flags; TMR_ and CTR_ for IEC timer and counter instances. Append the P&ID tag (e.g. AI_PressureTransmitter_PT_364) so the symbol directly maps to the process drawing. Avoid raw M-bits without symbolic names; a program with M-bit names in the symbol table can be documented, a program with bare M 20.0 references cannot.

How do I keep documentation aligned with the live PLC over years of changes?

Three practices: (1) increment the block Version field on every functional change and document the change in a project-level changelog; (2) regenerate the DOCPRO/TIA printout and the cross-reference at every change and store the PDF with the same revision number as the program archive; (3) periodically run an online/offline compare from the live PLC to the archived project, and reconcile any difference as an approved deviation or a pending change. Documentation that is regenerated only at project handover is out of date within six months on a typical plant.

Back to blog