S7-1200 HMI Alarm Printing with Serial and Network Printers

David Krause15 min read
HMI / SCADASiemensTutorial / How-to
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-1200 HMI Alarm Printing with Serial and Network Printers

An S7-1200 CPU 1212C paired with a KTP600 Basic mono PN HMI is a common entry-level Siemens automation stack used for machine and process visualization. When regulated industries, paper-archive requirements, or operator-driven logbooks are present, engineers must push alarm events (date, time, alarm text, and state transition) to a printer instead of, or in addition to, the on-screen alarm buffer. This reference consolidates every practical path for implementing alarm printing on this hardware tier: serial impact printers via the CM 1241 RS232 module, network-attached thermal and impact printers via LPR/RAW/IPP, SMTP email archival, and integration with a higher-level SCADA Alarm Printer service such as the one documented for AVEVA InTouch.

Critical caveat: The KTP600 Basic mono PN panel (6AV6647-0AB11-3AX0) runs WinCC Basic and does not expose a VBScript runtime. Any alarm-printing logic that depends on tag-triggered scripts must run in either a Comfort Panel, the CPU (SCL on S7-1200 firmware V4.0+), or on a connected PC. Plan architecture accordingly before specifying hardware.

Overview: Alarm Printing Requirements on S7-1200 / KTP600

An alarm printer must capture at minimum the following fields per logged event:

  • Date stamp (DD.MM.YYYY or configurable locale)
  • Time stamp (HH:MM:SS, preferably with milliseconds for process events)
  • Alarm identifier or tag name
  • Alarm text (multilingual if the project supports it)
  • State (Came In / Went Out / Acknowledged)
  • Optional: priority class, user name, associated value

Two physical architectures dominate this requirement:

  1. Serial path: CPU 1212C → CM 1241 RS232 module → dot-matrix or thermal line printer with serial interface. Reliable for 1–4 concurrent log channels.
  2. Network path: CPU 1212C or HMI → managed Ethernet switch → LAN printer (HP/JetDirect, EpsonNet, IPP-capable). Required when the printer is shared with an MES/ERP layer.

A third, increasingly preferred option is to send alarm events to an SMTP mailbox using the S7-1200 TMAIL_C instruction; the mailbox itself, or a downstream rules engine, then prints the event. This eliminates legacy paper hardware while satisfying the regulatory archive requirement.

S7-1200 1212C Hardware Constraints for Printer Interfaces

The CPU 1212C AC/DC/RLY or DC/DC/DC variant (6ES7212-1AE40-0XB0 / 6ES7212-1BE40-0XB0) ships with one PROFINET port and no onboard serial interface. To drive an RS232 printer you must add a CM 1241 communication module on the left-side signal board / module stack:

Module Order Number Function
CM 1241 RS232 6ES7241-1CH32-0XB0 RS232 (DB9 male), full-duplex, max 115.2 kbps
CM 1241 RS422/485 6ES7241-1CH30-1XB0 Differential, for long runs or multi-drop
CB 1241 RS485 6ES7241-1CH30-1XB0 Signal-board form factor, fits in CPU front
CSM 1277 switch 6GK7277-1AA10-0AA0 4-port unmanaged switch for LAN printer

Pin assignment on the CM 1241 RS232 DB9 follows the EIA-574 DTE convention: Pin 2 = TXD (out), Pin 3 = RXD (in), Pin 5 = GND. Handshaking is selectable in TIA Portal under Device configuration → CM 1241 → Properties → Port configuration; for most Epson ESC/P and OKI MICROLINE printers, select None (software flow control via XON/XOFF) and disable RTS/CTS unless the printer manual requires it.

A single CM 1241 occupies one slot in the signal module stack. The 1212C supports up to three CMs total, but only one RS232 module may be configured for the printer user port. Configure the port in TIA Portal as a "User-defined protocol" or use the supplied Siemens PtP drivers; for plain ASCII printing the Freeport / User-defined mode is the typical choice.

KTP600 Basic Mono HMI Capability Assessment

The KTP600 Basic mono PN (6AV6647-0AB11-3AX0) is a 6-inch, 4 grayscale, touch TFT panel running WinCC Basic V13 SP1 or newer inside TIA Portal. Capabilities relevant to alarm printing:

Feature KTP600 Basic mono KTP600 Comfort (comparison)
Alarms (discrete, analog) Yes, 4,000 max Yes, 4,000 max
VBScript runtime Not available Available
Scheduled tasks / global scripts Not available Available
Audit / GMP logging Not available Available
Number of connections 4 6
Print function on tag event Not supported natively Supported via HMIRuntime.Print
Direct network printer (LPR/RAW) Not supported Supported via system function

Because the Basic panel cannot host a print script, the printing logic must move down into the CPU. This actually simplifies integration: you treat the alarm events as PLC tags, build a formatted ASCII string in SCL, and stream it through the CM 1241 Freeport transmit block SEND_PTP. The HMI only displays the alarm buffer to the operator.

Printer Selection Matrix

Match the printer to the environment, not the other way around. The dominant choices for industrial alarm logging are impact (dot-matrix) for carbon-copy multipart forms and thermal for quiet, clean logs.

Class Examples Interface Use Case Notes
Dot-matrix impact (serial) Epson LX-350, OKI MICROLINE 320 RS232 (DB25), parallel Carbon-copy shop-floor logs, 24V noisy cabinets Rugged, slow (~250 cps), needs CM 1241 RS232 module
Thermal line printer Epson TM-T88, Star TSP143 RS232 or USB or Ethernet Receipt-style alarm journal, retail/process skids Quiet, fast, but paper is heat-sensitive; not always accepted by fire inspectors
Network laser / inkjet HP LaserJet Pro, Brother PJ-700 RJ45 (LPR/RAW/IPP) Office-grade A4 alarm reports, regulatory archive Highest availability; requires the CPU/HMI to push jobs over TCP
Fire/security impact Honeywell Two-Color Alarm Printer Serial or parallel, UL-listed UL 864 / ULC-S527 fire alarm logging Prints 50 messages in 90 s, two-color ribbon, sealed

For most S7-1200 installations an Epson LX-350 connected over RS232 to the CM 1241 is the lowest-risk choice. The printer accepts standard ESC/P commands and only needs CR (0x0D) + LF (0x0A) at the end of each line, with form feed (0x0C) at page break.

RS232 Path: CM 1241 Configuration in TIA Portal

Wire the CM 1241 DB9 to the printer's DB25 (or DB9) with a null-modem cable if both ends are DTE, or a straight cable if the printer presents a DCE port. Most Epson LX-350 ports are DTE, so use a null-modem (crossover) cable or set the printer's DIP switch to "Auto".

  1. In the TIA Portal project tree, expand Device configuration on the S7-1200 and drag the CM 1241 (RS232) from the catalog to the leftmost empty slot.
  2. Open Properties → Port configuration → Port. Set:
    • Baud rate: 9600 (typical for Epson LX-350; verify against the printer's DIP table)
    • Parity: None
    • Data bits: 8
    • Stop bits: 1
    • Flow control: None (or XON/XOFF if the printer manual requires it)
  3. Switch to Properties → Port configuration → Receive buffer. Leave default; this path is transmit-only for alarm logging.
  4. Assign a symbolic identifier to the hardware identifier (e.g., CM_PTPCONFIG_1) under Properties → General.

The CM 1241 must be initialized at PLC startup with the PORT_CFG block and activated with SEND_CFG. Both blocks are in the Communication → Communication processor → PtP instructions palette. The transmit buffer SEND_PTP pushes your formatted string to the UART.

SCL Implementation: Formatting and Transmitting Alarm Strings

The pattern below reads a global alarm event buffer, formats a single line, and transmits it through the CM 1241 every time a new event is queued. Store the following data block in the project and call the function block from the alarm OB (typically OB1 or a dedicated alarm-cyclic OB).

// FB_AlarmPrinter - called from OB1 on every cycle
DATA_BLOCK "dbAlarmPrinter"
  STRUCT
    bTrigger : BOOL;             // rising edge = new alarm in queue
    sLine : STRING[120];         // pre-formatted print line
    bBusy : BOOL;                // SEND_PTP busy
    bDone : BOOL;                // transmission complete
    bError : BOOL;               // CM 1241 error
    wStatus : WORD;              // status word from SEND_PTP
  END_STRUCT
END_DATA_BLOCK

FUNCTION_BLOCK "FB_AlarmPrinter"
{ S7_Optimized_Access := 'TRUE' }
VAR
    ptpConfig  : PORT_CFG;       // hardware ID of CM 1241 RS232
    ptpSendCfg : SEND_CFG;
    ptpSend    : SEND_PTP;
END_VAR

BEGIN
    // Initialise once
    IF NOT ptpConfig.Done THEN
        ptpConfig(REQ := TRUE, PORT := "CM_PTPCONFIG_1",
                  PROTOCOL := 0,            // 0 = Freeport / User-defined
                  BAUD := 9600,
                  PARITY := 0,              // 0 = None
                  DATABITS := 8,
                  STOPBITS := 1,
                  FLOWCTRL := 0);           // 0 = None
    END_IF;

    // Arm the transmitter
    IF NOT ptpSendCfg.Done THEN
        ptpSendCfg(REQ := TRUE, PORT := "CM_PTPCONFIG_1",
                   REQ_ID := 16#0001,
                   ACK_PROFILE := 16#01,
                   SYNC_PROFILE := 16#01,
                   BAUDRATE := 9600,
                   PARITY := 0,
                   DATABITS := 8,
                   STOPBITS := 1,
                   IDOP := 0,
                   RES_DELAY := 0,
                   ACK_DELAY := 0,
                   ACK_NACK := FALSE);
    END_IF;

    // Send line on rising edge of trigger
    IF "dbAlarmPrinter".bTrigger AND NOT ptpSend.BUSY THEN
        ptpSend(REQ := TRUE,
                PORT := "CM_PTPCONFIG_1",
                BUFFER := "dbAlarmPrinter".sLine,
                LENGTH := 0,                 // 0 = use STRING length
                DONE => "dbAlarmPrinter".bDone,
                ERROR => "dbAlarmPrinter".bError,
                STATUS => "dbAlarmPrinter".wStatus);
        "dbAlarmPrinter".bTrigger := FALSE;
    END_IF;
END_FUNCTION_BLOCK

Build sLine from a date/time source (use the CPU's RD_SYS_T for local time, or RD_LOC_T for timezone-corrected time) and the alarm text pulled from your project's text list. A clean line format:

// Example formatted line (120 chars max)
'dbAlarmPrinter'.sLine := CONCAT(IN1 := '25.10.2025',
                                 IN2 := ' 14:32:07 ',
                                 IN3 := 'Came In  ',
                                 IN4 := 'HIGH      ',
                                 IN5 := 'Motor M12 Overtemp  ',  // from text list
                                 IN6 := '$0D$0A');               // CR + LF

Insert $0C at page break intervals if you want a perforated tear line. Run a checksum verification against the printer by also sending $1B followed by an ESC/P command such as '@' at session start to reset the printer.

Network Printer Path: LPR, RAW, IPP

If the panel or the PLC pushes alarm records to a LAN printer, three protocols are realistic on an S7-1200 / WinCC environment:

Protocol Port Initiator Notes
RAW (JetDirect / AppSocket) 9100 PC-based script, SCADA, or Comfort Panel Simplest; plain TCP socket, raw ASCII payload
LPR/LPD 515 PC-based service RFC 1179; spool queue; needs LPD daemon on Windows
IPP 631 Windows print queue Modern; needs IPP-enabled printer and HTTP/TLS

The S7-1200 CPU cannot open a raw TCP socket for printing directly without writing custom TCON/TSEND logic; this is fragile and is therefore not recommended. Instead, run a small Windows service on a plant-floor PC that listens on a TCP port (e.g., 9101) and forwards formatted lines to the configured network printer. The PC service then reads either:

Configure the network printer with a static IP, reserve it in DHCP, and disable sleep timers so the LAN card stays reachable. Test with telnet <printer IP> 9100; typing any text and pressing Enter should produce a printout.

TIA Portal Alarm System Configuration

Even with a custom print routine, you still configure the alarm source in TIA Portal so that the HMI's standard alarm window and the PLC-side print FB both see the events.

  1. In the PLC program, create a global data block AlarmEvents with the fields State (USINT, 1=Came In, 2=Went Out, 3=ACK), ID (DINT), TextID (DINT), Value (REAL).
  2. From each AlarmBit logic in the program, on a rising edge set the corresponding entry, set bTrigger := TRUE in dbAlarmPrinter, and raise a global HMI tag that the panel watches.
  3. In the HMI project, open HMI Tags → Alarm and add the alarms with the same trigger tags; configure the alarm class colors and the acknowledge model.
  4. On the KTP600 Basic, the alarm window automatically reflects the events but does not initiate printing — printing must be driven from the CPU side as shown above.
If a Comfort Panel is in the project, you can avoid the CPU-side FB by configuring a VBScript under Scheduled tasks → OnAlarm that calls HMIRuntime.Print. Basic panels do not have this option, which is why the SCL path is the canonical solution for the S7-1200 + KTP600 Basic combination.

SMTP Email Notification as the Modern Archive

For installations where paper is optional, the S7-1200's TMAIL_C instruction (firmware V4.0 and newer) is the cleanest route. Configure the CPU as an SMTP client, point it at the corporate mail relay, and email each alarm to an operator distribution list. The mailbox is the audit log; IT can apply retention policies and search it.

// Triggered by rising edge of "dbAlarmPrinter".bTrigger
"dbMail".TO_S := '[email protected]';
"dbMail".CC := '';
"dbMail".SUBJECT := CONCAT(IN1 := 'ALARM ',
                            IN2 := 'Motor M12 Overtemp ',
                            IN3 := 'Came In');
"dbMail".TEXT := 'Timestamp 2025-10-25 14:32:07 / State Came In / Value 84.7';
"dbMail".MAIL_SERVER := 'smtp.plant.example';
"dbMail".USERNAME := '[email protected]';
"dbMail".PASSWORD := 'REDACTED';
"dbMail".FROM := '[email protected]';
TMAIL_C(REQ := "dbAlarmPrinter".bTrigger,
        DB_MAIL := "dbMail",
        DONE => "dbMail".bDone,
        ERROR => "dbMail".bError,
        STATUS => "dbMail".wStatus);

Mail relays often queue on retry; if the relay is down, alarms will be lost unless buffered. Use the same AlarmEvents DB as a FIFO buffer of, say, 200 entries so that transient network outages do not drop alarms.

Dedicated Fire/Security Alarm Printer Integration

For UL 864 / EN 54 fire-alarm panels and similar regulated systems, a generic office printer is unacceptable. The Honeywell Two-Color Alarm Printer is a representative industrial solution that prints 50 individual alarm messages within 90 seconds, uses a sealed two-color ribbon, and is UL Fire and Security listed. Wiring is typically RS232 (DB9) into a fire-alarm control panel's annunciator port; the protocol is a simple ASCII frame.

To integrate a Honeywell-style printer with an S7-1200:

  1. Verify the printer protocol from its installation manual (most publish an "Alarm printer serial protocol" appendix). Confirm baud rate, parity, and message framing.
  2. Add a CM 1241 RS232 module as previously described and match the port parameters exactly. Mismatched baud rates will cause silent failure — verify with a serial-line analyzer or USB-RS232 dongle.
  3. Wrap each alarm event in the protocol's start/stop bytes and checksum, then transmit through SEND_PTP. Most protocols expect a fixed-length record (e.g., 32 bytes).
  4. Log transmitted bytes to a debug DB so the AHJ inspector can replay the journal if a printer misfeed occurs.

AVEVA InTouch Alarm Printer Reference Architecture

If a higher-level SCADA such as AVEVA (formerly Wonderware) InTouch is already aggregating the S7-1200 alarms, delegate printing to the Alarm Printer service documented at Print alarms with the alarm printer – AVEVA Documentation. The architecture becomes:

  • S7-1200 → OPC UA / S7 connection to InTouch (with the Comfort Panel or a 3rd-party OPC server bridging the Basic panel).
  • InTouch Alarm Printer service runs on the SCADA server, formats the alarm, and dispatches to a local or LAN printer using the print spooler.
  • Operators can manually start or stop the printer query from the InTouch window while the service runs in the background.

This path is the cleanest when the plant has any non-trivial SCADA footprint because the Alarm Printer handles spooling, retries, and queue persistence automatically.

Verification and Commissioning

Walk through these checks during acceptance testing:

  1. Loop-back test: connect pins 2 and 3 of the CM 1241 DB9 to verify RCV_PTP echoes every transmitted byte.
  2. Printer reset: power-cycle the printer and confirm it prints a self-test page; if not, the serial port or cable is the suspect.
  3. Trigger test: force bTrigger := TRUE from a watch table and observe the formatted line on the printer within 200 ms.
  4. State coverage: exercise Came In, Went Out, and Acknowledged transitions and confirm the leading 12 characters of the line match the expected column.
  5. Time accuracy: compare the printed timestamp against an NTP-synced reference; an S7-1200 without time sync will drift within hours and invalidate the audit trail. Configure PLC → Properties → Time of day → Synchronization via NTP.
  6. Buffer test: flood 50 alarms in 5 seconds and confirm none are lost; the SEND_PTP busy flag should drop between prints.
  7. Failure path: disconnect the printer cable and verify that the system raises a diagnostic alarm (e.g., on HMI tag AlarmPrinterFault) instead of stalling the CPU.

Troubleshooting Matrix

Symptom Likely Cause Remedy
No output at all CM 1241 not initialised; bTrigger not rising Watch ptpConfig.Done and ptpSendCfg.Done; force bTrigger from watch table
Garbled characters Baud rate / parity mismatch Match CM 1241 port configuration to printer DIP switches; verify with terminal emulator
Status word 16#0001 Send buffer in use Re-trigger only after DONE or ERROR; do not stack REQ pulses
Status word 16#80C1 Hardware ID not assigned Re-check CM 1241 hardware identifier constant CM_PTPCONFIG_1
Printer prints but no line feeds CR-only mode, no LF Append $0A to string; verify with hex view in watch table
KTP600 Basic shows no script option WinCC Basic lacks VBScript Move printing logic to SCL on the CPU or upgrade to Comfort Panel
Network printer unreachable Spooler paused, IP changed Reserve static DHCP; check telnet <IP> 9100; verify Windows firewall allows port 9100
Email lost during outage SMTP relay down Buffer up to 200 events in PLC DB; retransmit on DONE rising edge

Frequently Asked Questions

Can a KTP600 Basic mono HMI drive an alarm printer directly?

No. WinCC Basic does not include a VBScript runtime, so there is no scheduled-task hook to call a print function. Print logic must run in the CPU (SCL using SEND_PTP on the CM 1241 RS232) or in a higher-level SCADA service such as AVEVA InTouch Alarm Printer. A Comfort Panel (KTP600 Comfort or larger) can host the print script via HMIRuntime.Print.

Which Siemens module adds RS232 to a CPU 1212C?

The CM 1241 RS232 module (6ES7241-1CH32-0XB0) plugs into the left-side signal-module stack and is configured under Device configuration → Properties → Port configuration in TIA Portal. For the 1212C, also confirm free slots: it supports up to three CMs total including signal boards.

What baud rate should I use for an Epson LX-350 alarm printer?

9,600 baud, 8 data bits, no parity, 1 stop bit is the safest default and matches the Epson DIP factory setting. Higher rates (38,400 or 115,200) work on the LX-350-II but require DIP changes; always verify with a terminal-emulator loop-back before relying on the rate in production.

How do I send alarms over the network instead of serial?

Add a small Windows service on the plant network that listens on TCP port 9101 (or any free port) and forwards formatted lines to a network printer on RAW port 9100. Have the S7-1200 push alarms to that service via a TCON/TSEND pair or, preferably, expose them via OPC UA to a Comfort Panel or SCADA that owns the print job. Direct RAW socket printing from the PLC is fragile and not recommended.

Is there a Siemens-approved printer for regulated fire/security applications?

Siemens does not publish a specific alarm-printer part number for the S7-1200 line; in regulated installations you typically select a UL-listed fire-alarm printer such as the Honeywell Two-Color Alarm Printer. Confirm protocol compatibility (frame format, baud rate, handshake) against the printer's installation manual and add the CM 1241 RS232 module to drive it.

Can I email alarms from the S7-1200 instead of printing?

Yes. Use the TMAIL_C instruction (firmware V4.0 and newer) to send formatted alarm messages through your SMTP relay. Treat the mailbox as the audit log and apply IT retention policies; this is generally preferred for new installations because it eliminates paper handling and supports full-text search.

Back to blog