S7-1200 CM 1241 RS485 Communication with KEPServerEx on TIA

David Krause11 min read
S7-1200SiemensTutorial / 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

Overview

When the integrated PROFINET port of a SIMATIC S7-1200 CPU (for example, CPU 1214C DC/DC/DC, 6ES7214-1AG40-0XB0) is fully occupied by an HMI panel such as a KTP600, an additional communication path to a supervisory PC is still feasible through the left-side communication module (CM) bus. The CM 1241 family — available in RS232 (6ES7241-1AH32-0XB0) and RS422/485 (6ES7241-1CH32-0XB0) variants — provides a galvanically isolated serial interface that maps cleanly to an OPC server such as KEPware's KEPServerEx using either the Modbus RTU/ASCII or the Siemens ASCII driver.

This reference walks through the full path: module selection, TIA Portal V17 hardware configuration, serial parameter assignment, Send_Config / Receive_Config / Send_P2P / Receive_P2P instruction wiring, KEPServerEx channel/device setup, and end-to-end verification. Where a limitation exists on the Ethernet side (CPU firmware, PG/PC and HMI connection budget), an unmanaged CSM 1277 (6GK7277-1AA10-0AA0) is documented as a valid fallback.

Prerequisites

  • CPU 1214C DC/DC/DC (6ES7214-1AG40-0XB0) with firmware V4.2 or higher. The CM 1241 point-to-point protocol blocks were promoted from the PtP library in TIA V13 to the S7-1200 base instruction set from firmware V4.0 onward; V4.4 is recommended for current TIA Portal V17 projects.
  • CM 1241 RS422/485 (6ES7241-1CH32-0XB0) — supports both 2-wire RS485 and 4-wire RS422. Use this article's part for the 2-wire RS485 multidrop case; for true RS232 flow, swap to the 6ES7241-1AH32-0XB0 variant.
  • TIA Portal V17 (or V16 with HSP 0294) for the CM 1241 V2.1 hardware catalog entry.
  • KEPServerEx V4.0 (as referenced) or current V6.x with the Siemens TCP/IP Ethernet or Modbus RTU/ASCII driver enabled. The KEPServerEX Modbus RTU/ASCII driver is the typical path for an RS485 bus.
  • Shielded twisted-pair cable (e.g. Belden 9841 for RS485), shield grounded at one end, 120 Ω termination at both physical ends of the RS485 segment.
  • 24 V DC supply for the CM 1241, 0.5 A minimum headroom beyond the CPU 24 V budget.
Connection-budget reality check. A CPU 1214C PROFINET port supports up to 3 HMI connections, 1 PG connection, 8 active PUT/GET server connections, and additional S7 communication / Open User Communication partners. The Ethernet port is rarely the actual bottleneck; an OPC server using KEPServerEX's Siemens TCP/IP driver over PROFINET is feasible. Use CM 1241 when the PC software stack is locked to a serial OPC driver or when the site has no Ethernet drop to the SCADA machine.

CM 1241 RS422/485 Technical Specifications

Per the CM 1241 RS422/485 technical specifications page in the SIMATIC S7-1200 Manual Collection, the module is rated for the values summarized below.

Parameter Value
Article number 6ES7241-1CH32-0XB0
Supply voltage 24 V DC (20.4 – 28.8 V), 220 mA typ.
Power dissipation 1.1 W typ.
Supported standards RS232C (TIA-232-F), RS422/485 (TIA-422-B, TIA-485-A)
Baud rates 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 76800, 115200 bps
Bit framing 7E1, 7E2, 7N2, 7O1, 7O2, 7N1, 8E1, 8E2, 8N1, 8N2, 8O1, 8O2
Cable length, RS485 1 000 m at ≤ 19 200 bps; 500 m at 38 400 bps; 250 m at 76 800 bps; 100 m at 115 200 bps
Cable length, RS232 10 m maximum
Common-mode voltage ±7 V (RS485) / ±25 V (RS422) isolation
Termination Internal 390 Ω pull-up / 390 Ω pull-down, switchable 220 Ω line-to-line; toggle via DIL switch on the bottom of the module
Handshake RS232 hardware (RTS/CTS) or XON/XOFF; RS485 only XON/XOFF or none
User data per send call ≤ 1 024 bytes (PtP); ≤ 255 bytes via Modbus master per request
Block library (TIA) SFB / FB: Send_Config, Receive_Config, Send_P2P, Receive_P2P, Modbus_Comm_Load, Modbus_Master, Modbus_Slave

Hardware Topology

CPU 1214C (6ES7214-1AG40-0XB0) PROFINET LAN KTP600 HMI Panel CM bus CM 1241 RS422/485 6ES7241-1CH32-0XB0 DIP: 220 Ω + 390 Ω 2-wire USB-RS485 Isolated PC KEPServerEx OPC DA/UA

Pin-out for the CM 1241 RS422/485 in 2-wire mode (terminal block on the bottom of the module):

Pin Signal (RS485 2-wire) Wire color (typical)
1 TXD-/RxD- (B / B') Red pair conductor 1
2 TXD+/RxD+ (A / A') White pair conductor 1
3 GND (signal reference) Drain wire
4 Shield / PE Overall shield

Step 1 — Configure the CM 1241 in TIA Portal

  1. In the project tree, open Devices & Networks and select the S7-1200 CPU.
  2. In the Hardware catalog, navigate to Communication modules → CM 1241 → RS422/485. If only the older V1.0 catalog entry appears, install Hardware Support Package HSP 0294 (TIA V17) or the matching HSP for your installed TIA version.
  3. Drag the module to slot 101 of the CPU. The 1214C supports up to three CM/CP modules; slot 101 is the leftmost.
  4. Open the module's PropertiesPort configuration and set the values that match KEPServerEx.
Parameter Recommended value (Modbus RTU) Alternative (Siemens ASCII)
Protocol selection Modbus master (RTU) Freeport / ASCII
Baud rate 19 200 9 600
Parity Even (8E1) None (8N1)
Flow control None None
Receive line initial state R = idle high R = idle high
RS485 termination On (DIP switch 1 = ON) On
Half-duplex 2-wire, half-duplex 2-wire, half-duplex

Step 2 — Program the Modbus Master in OB1

Insert the standard S7-1200 Modbus master blocks from Instructions → Communication → Modbus. The order of instantiation matters: Modbus_Comm_Load must execute once on the rising edge of REQ to bind the CM to the DBs.

// Modbus_Comm_Load – executed once on cold start
#Modbus_Comm_Load.REQ      := TRUE;            // pulse TRUE for one cycle
#Modbus_Comm_Load.PORT     := 0;               // CM slot index 0 = first CM
#Modbus_Comm_Load.BAUD     := 19200;
#Modbus_Comm_Load.PARITY   := 2;               // 0=None, 1=Odd, 2=Even
#Modbus_Comm_Load.FLOW_CTRL:= 0;               // 0=None, 1=Hardware, 2=XON/XOFF
#Modbus_Comm_Load.TIMEOUT  := 1000;            // ms per request
#Modbus_Comm_Load.MODE     := 0;               // 0=Full duplex RS232, 1=RS485 half-duplex
#Modbus_Comm_Load.DONE     => #cfg_done;
#Modbus_Comm_Load.ERROR    => #cfg_err;
#Modbus_Comm_Load.STATUS   => #cfg_stat;

Then issue a Modbus request — for example read holding registers from the PC side. Note that the CM 1241 acts as a master toward KEPServerEx acting as a virtual slave; if KEPServerEx is the OPC concentrator and the S7-1200 must be polled, the CM is the master. If you prefer KEPServerEx to poll, swap the role: on the CM, switch protocol to Modbus slave in the port configuration.

// Modbus_Master – read 10 holding registers starting at 40001
#Modbus_Master.REQ        := #poll_trig;      // 1-Hz pulse from cyclic OB
#Modbus_Master.MB_ADDR    := 1;               // slave ID on the bus
#Modbus_Master.MODE       := 0;               // 0=Read, 1=Write, 2=Read/Write, 3=Write multiple
#Modbus_Master.DATA_ADDR  := 0;               // 0-based Modbus address (40001 → 0)
#Modbus_Master.DATA_LEN   := 10;              // number of registers
#Modbus_Master.DATA_PTR   := #HoldingRegs;    // ARRAY[0..9] OF WORD in a global DB
#Modbus_Master.DONE       => #rx_done;
#Modbus_Master.ERROR      => #rx_err;
#Modbus_Master.STATUS     => #rx_stat;

Step 3 — KEPServerEx Channel and Device

  1. Launch KEPServerEX Configuration. In V4.0, choose Edit → Add Channel. Pick Modbus RTU Serial for an RS485 bus.
  2. Channel properties — COM port: assign the virtual COM the USB-RS485 adapter enumerated (e.g. COM4). Baud: 19200, Parity: Even, Data bits: 8, Stop bits: 1, Handshaking: None. Set Wait for Device Request to No if the S7-1200 is acting as master.
  3. Add a Device. Use slave ID 1, ID format Decimal, and zero-based addressing for the holding-register block. Click Add Tag for each value, mapping it to an OPC tag the SCADA consumes (e.g. Channel1.Device1.HoldingRegister0000).
  4. Right-click the channel → OPC Quick Client to verify the tag updates when the S7-1200 CM 1241 transmits.

Step 4 — Asynchronous Freeport (Siemens ASCII) Variant

If the SCADA application uses legacy ASCII frames, drop the Modbus master FB and use the PtP instructions instead. The flow is: configure once with Send_Config and Receive_Config, then trigger Send_P2P on demand and evaluate Receive_P2P on the line-idle interrupt from RCV_CFG.

// Send_P2P – push a 16-byte telemetry frame
#Send_P2P.REQ    := #tx_pulse;
#Send_P2P.PORT   := 0;
#Send_P2P.BUFFER := #txFrame;     // VARIANT to a POKE'd area, max 1024 bytes
#Send_P2P.LENGTH := 16;
#Send_P2P.DONE   => #tx_done;
#Send_P2P.ERROR  => #tx_err;
Buffer size guard. On the CM 1241 the maximum per-call payload is 1 024 bytes for freeport. For Modbus, each request is limited to 255 bytes of PDU. Truncate telegrams in the PLC before calling Send_P2P or you will receive STATUS = 16#80C8 (resource error).

Verification

  1. From TIA Portal, download the project to the CPU in RUN. Confirm that the CM 1241 is online (Online & diagnostics → Diagnostics → Port diagnostics shows Status OK and the configured baud).
  2. Open KEPServerEx Quick Client. Force the CM to send with a watch-table value of TRUE on poll_trig. Holding-register tags must tick at the 1-Hz poll rate.
  3. Inspect the LED of the CM 1241: green TxD flashes on each master query, amber RxD flashes on each slave response. Persistent red ERROR indicates framing or termination problems.
  4. Use a USB protocol analyzer (e.g. Systembase PortView 7 / Moxa Uport 1100) on a Y-splitter to capture bus traffic and confirm the Modbus CRC16 (or ASCII LRC) matches the values returned to the PLC's #rx_stat.

Error Code Reference for the CM 1241 PtP / Modbus Blocks

STATUS (hex) Cause Remedy
16#0000 No error
16#80C8 Buffer too long / busy Limit to 1 024 bytes; wait for DONE before re-issuing
16#80D1 Receive timeout Increase RCV_TIMEOUT; verify slave is responding
16#80D2 Parity / framing error Match PARITY and DATA bits between CM and KEPServerEx channel
16#80E0 Buffer overflow Reduce poll rate or drain with another Receive_P2P call
16#80FF Hardware fault on the module Power-cycle; replace module if status persists

Troubleshooting Matrix

Symptom Likely cause Action
No Tx LED, DONE never asserts Modbus_Comm_Load never executed or MODE set to RS232 instead of RS485 Check first-scan bit, set MODE = 1 for half-duplex RS485
Tx LED on, no Rx LED, KEPServerEx shows Error A/B polarity reversed or 120 Ω termination missing at far end Swap A and B; enable internal termination via DIP 1
Intermittent timeout, OK at low baud Stub length too long, no shield ground Restrict stubs to < 0.3 m; bond shield at one end only
CM 1241 absent in TIA hardware catalog HSP not installed for TIA version Install HSP 0294 (V17) or matching HSP
CPU 1214C reports "Resource problem, no further resources available" More than 3 CMs plugged, or Modbus_Comm_Load re-triggered continuously Limit to 3 modules; pulse REQ for one cycle only
KEPServerEx sees garbage characters Baud mismatch Confirm 19200 / 8E1 on both sides

CSM 1277 Alternative Path (When Ethernet Is Actually Open)

Before reaching for the CM 1241, verify whether the Ethernet path is exhausted. The S7-1200 PROFINET interface provides up to 16 active connections depending on CPU firmware, with the budget allocated as: 1 PG/PC (HMI use), 3 HMI panels, 8 PUT/GET, 4 S7 communication. A CSM 1277 (6GK7277-1AA10-0AA0) is an unmanaged 4-port switch that is not configured in TIA Portal — it is invisible in the project tree, requires only a 24 V supply, and is the canonical way to add a second Ethernet node to the same CPU port without consuming a HMI connection slot from the panel.

TIA Portal does not display the CSM 1277 in the device catalog for S7-1200. This is expected: it is purely a Layer-2 device with no IP or PROFINET name to manage.

Field Commissioning Checklist

  • Verify 24 V to the CM 1241; measure > 20.4 V at the module terminals under load.
  • Enable internal termination (DIP 1) on the CM and at the KEPServerEx RS485 isolator. The standard 120 Ω RS485 termination lives at the two physical line ends only — never in the middle.
  • Confirm 24 V common between the CPU and the USB-RS485 isolator (signal ground tied, PE separate).
  • Capture the bus with a USB analyzer during a single Modbus_Master cycle and verify the round-trip is < 100 ms at 19 200 bps for a 10-register read.
  • Disable any Windows power management on the USB-to-serial adapter (Device Manager → Power Management tab → uncheck "Allow the computer to turn off this device to save power").

FAQ

Can the CPU 1214C's PROFINET port serve a KTP600 and KEPServerEx at the same time?

Yes. The S7-1200 supports 3 HMI connections and 1 PG/PC connection in addition to PUT/GET and S7 communication. KEPServerEx uses the Siemens TCP/IP Ethernet driver and is treated as a PG-class connection. Only when that budget is fully consumed should you fall back to a CSM 1277 unmanaged switch or to the CM 1241 serial module.

Why does TIA Portal not show the CSM 1277 in the device catalog?

The CSM 1277 (6GK7277-1AA10-0AA0) is an unmanaged Layer-2 switch with no IP, no PROFINET name, and no diagnostics. It is intentionally absent from the S7-1200 hardware catalog; you only need to wire 24 V and the RJ45 ports.

Which KEPServerEx driver should I pick for the CM 1241 RS485?

For Modbus RTU/ASCII traffic use the "Modbus RTU Serial" channel with a USB-RS485 isolator. For legacy Siemens ASCII protocols use the "Siemens Serial" driver. The "Modbus TCP/IP Ethernet" driver does not apply to the CM 1241 — it is for the PROFINET port or CP 1243-1.

What is the maximum RS485 cable length at 19200 baud?

1 000 m for RS485 at 19 200 bps and lower per the CM 1241 specification, dropping to 100 m at 115 200 bps. Use shielded twisted pair and place 120 Ω terminations only at the two physical line ends.

Why does the CM 1241 stay silent after a download?

The most common cause is that Modbus_Comm_Load was not executed — verify the call is in OB1, OB100, or a startup OB. STATUS 16#80D1 on the master indicates a receive timeout, while STATUS 16#80C8 indicates a buffer overflow or resource busy condition.

Back to blog