Overview: S7-1200 to Altivar 312 over Modbus RTU
Integrating a Siemens SIMATIC S7-1200 CPU 1214C with Schneider Electric Altivar 312 (ATV312) variable frequency drives over Modbus RTU is a common low-cost serial integration used in machinery retrofits and small distributed drive networks. The S7-1200 platform supports Modbus RTU through the CM 1241 communication module or the lower-cost CB 1241 communication board, both of which expose an RS-485 half-duplex interface suitable for multi-drop connection of up to 32 Altivar 312 nodes on a single twisted pair.
This article documents a proven field wiring scheme, the relevant TIA Portal V11 SP1 (and later) configuration parameters, the Modbus register map for the ATV312, and the typical fault matrix encountered when commissioning a CB1241-to-ATV312 link. All register, register, and parameter references are taken from official Siemens and Schneider documentation.
Hardware Selection: CM 1241 vs CB 1241
The S7-1200 family provides two RS-485 options. The decision between them drives the mechanical layout of the panel and the wiring approach.
| Feature | CM 1241 (6ES7241-1CH30-0XB0) | CB 1241 (6ES7241-1CH30-1XB0) |
|---|---|---|
| Form factor | Signal module (left of CPU) | Signal board (bottom of CPU) |
| Interface | RS-485, 6-pin terminal block | RS-485, 6-pin terminal block |
| Max nodes on bus | 32 | 32 |
| Max baud rate | 115.2 kbps | 115.2 kbps |
| Galvanic isolation | Yes | Yes |
| Termination | Onboard switchable (TRA/TA, TRB/TB) | Onboard switchable (TRA/TA, TRB/TB) |
| Typical use | Distributed panels, hot-swap spare | Cost-optimized, single-board builds |
For a single-machine installation controlling nine ATV312 drives, the CB 1241 is the preferred choice: it occupies the signal-board slot directly under the CPU, requires no additional DIN-rail width, and exposes the same six RS-485 terminals (A, B, M, TRA/TA, TRB/TB, shield) as the CM 1241. Both boards are recognized by the TIA Portal hardware catalog under the same article family and use the same Modbus RTU instruction set.
Altivar 312 Modbus Port: RJ45 Pinout
The Altivar 312 provides a single RJ45 connector on the front of the drive labelled "Modbus." Inside the drive, this connector terminates a 2-wire RS-485 segment with a common-mode reference (0V). The drive ships with the bus terminator off by default; it is enabled by setting SW1 on the front of the drive to the 120 Ω position only on the two physical end-of-line units.
| RJ45 Pin (ATV312) | Signal | Description |
|---|---|---|
| 1 | — | Reserved / not connected |
| 2 | — | Reserved / not connected |
| 3 | — | Reserved / not connected |
| 4 | D1 (B / TRB) | RS-485 non-inverting (B line) |
| 5 | D0 (A / TRA) | RS-485 inverting (A line) |
| 6 | — | Reserved / not connected |
| 7 | — | Reserved / not connected |
| 8 | Common (0V / M) | Modbus signal common |
CB 1241 Terminal Layout and Field Wiring
The CB 1241 exposes six captive screw terminals labelled M, TA, TB, TRA, TRB, and shield. Their meaning in RS-485 Modbus RTU mode is summarized below.
| CB 1241 Terminal | Function | Connect To |
|---|---|---|
| M | Logic common (0V) | ATV312 RJ45 pin 8 (Common) |
| TA | Termination A (polarized with TRA) | Jumpered to TRA at end-of-line |
| TB | Termination B (polarized with TRB) | Jumpered to TRB at end-of-line |
| TRA | RS-485 A line (inverting) | ATV312 RJ45 pin 5 (D0) |
| TRB | RS-485 B line (non-inverting) | ATV312 RJ45 pin 4 (D1) |
| Shield | Cable shield drain | Panel ground bar, single point |
Wiring diagram (ASCII)
ATV312 #1 (Node 1) CB 1241 (S7-1200)
RJ45 Terminal
pin 5 D0 ------------> TRA
pin 4 D1 ------------> TRB
pin 8 Com ------------> M
(shield drain) ----------> Shield (panel PE)
Trailing units: ATV312 #2..#9 daisy-chained on D0/D1/Com
End-of-line terminator: ON only on #1 and #9 (or on CB1241 if it is at one end)
Use a shielded twisted pair rated for the cabinet environment (e.g., Belden 3106A or equivalent). Do not run the Modbus cable in the same conduit as VFD output power wiring. The shield should be bonded to PE at the panel entry point only; do not bond both ends unless the cable run exceeds 30 m and a high-quality low-impedance ground path exists.
Configuring the ATV312 Modbus Port
Before bringing the bus up in TIA Portal, configure each drive's serial port parameters to match the master. The relevant menu on the ATV312 front-panel HMI is COMM → Modbus.
| ATV312 Parameter | Code | Recommended Value | Notes |
|---|---|---|---|
| Modbus address | Add | 1..9 (one per drive) | Must be unique; 1..247 valid |
| Baud rate | tbr | 19.2 kbps | 96 / 192 / 384 selectable |
| Parity | Par | 8E1 (8 data, even, 1 stop) | ATV312 default; matches S7-1200 default |
| Frame format | FO1 | RTU | RTU = binary; ASCII = printable (do not use) |
| Com timeout | tto | 10.0 s | Drive trips on SLF if exceeded |
| Termination | SW1 | ON at end units only | 120 Ω across D0-D1 |
TIA Portal Project Configuration
From TIA Portal V11 SP1 onwards, the Modbus RTU instruction set is delivered as part of the standard library Modbus_Comm_Load and Modbus_Master (or, in V13+, MB_COMM_LOAD and MB_MASTER). The following procedure assumes a CPU 1214C DC/DC/DC with a CB 1241 in the signal board slot.
-
Add the CB 1241 to the device configuration. In the project tree, open Device Configuration > Signal Board and drag the
CB 1241 (RS-485)article (6ES7241-1CH30-1XB0) into the slot. Assign portRS-485a hardware identifier (HW ID); record this value, it is required by the instruction blocks. -
Create the Modbus data blocks. Add a global DB named
Modbus_Master_DBand declare an instance ofMB_MASTER(orMODBUS_MASTERfor V11 SP1) inside it. Add a second DBModbus_Comm_Load_DBand declare an instance ofMB_COMM_LOAD/MODBUS_COMM_LOAD. -
Set Modbus RTU mode. In the CB 1241 properties, set Mode =
Modbus RTU Master, Baud rate =19200, Parity =Even, Stop bits =1, Data bits =8, and Flow control =None. -
Call MB_COMM_LOAD once on cold restart. Wire
REQto a one-shot from OB100 or the first cycle of OB1,PORTto the CB 1241 HW ID,BAUDto 19200,PARITYto 2 (even),MB_DBto the master instance DB, andDONE/ERROR/STATUSto retentive tags for diagnostics. - Call MB_MASTER per drive. Schedule nine MB_MASTER calls, one per ATV312, each targeting a different slave address (1..9). Use a cyclic OB (e.g., OB1) with a 100 ms execution gate, or a time-based OB30 at 100 ms, to avoid flooding the bus.
Sample Ladder/Structured Text for One Drive
The following SCL snippet (TIA Portal V13+) shows a single MB_MASTER call that reads the drive status word and writes the control word to ATV312 at node 1.
// MB_MASTER call - read 2 words from drive #1, write 1 word
IF Comm_Load_Done THEN
MB_MASTER_1(
REQ := TRUE,
MB_ADDR := 1, // ATV312 Modbus address
MODE := 1, // 1 = Read, 2 = Write, 4 = Read/Write
DATA_ADDR := 3201, // ETA (status word) - Modbus address 3201
DATA_LEN := 2, // 2 words: ETA + RFRD
DATA_PTR := P#DB5.DBX0.0 BYTE 4,
DONE => Read_Done_1,
BUSY => Read_Busy_1,
ERROR => Read_Error_1,
STATUS => Read_Status_1
);
END_IF;
The corresponding MB_MASTER write to the command word uses MODE := 2, DATA_ADDR := 8501 (CMD, the control word), and DATA_LEN := 1.
ATV312 Modbus Register Map (Excerpt)
The Altivar 312 Modbus communication manual defines a contiguous address space. The following excerpt covers the registers most commonly used in a multi-drive supervisory application.
| Modbus Address | Symbol | Access | Description |
|---|---|---|---|
| 3201 | ETA | Read | Status word (bit-coded) |
| 3202 | RFRD | Read | Output frequency (×0.1 Hz) |
| 3203 | LCRD | Read | Motor current (×0.1 A) |
| 3204 | OTRD | Read | Motor torque (signed %) |
| 8501 | CMD | Read/Write | Control word |
| 8502 | LFRD / LFR | Read/Write | Frequency reference (×0.1 Hz) |
| 8504 | SP1..SP7 | Read/Write | Preset speeds |
| 32021 | Drive state | Read | Operating state (0=ready, 4=running, 7=stop) |
| 32023 | Last fault | Read | Code of last detected fault |
MB_MASTER, the function code is 03 (read holding) for the 8xxx and 4xxx/3xxx blocks as defined; confirm the function code on the drive by reading parameter FCod.Control and Status Word Bit Mapping
| Bit | CMD (8501) Function | ETA (3201) Function |
|---|---|---|
| 0 | Run forward (1=enable) | Ready to switch on |
| 1 | Run reverse (1=enable) | Switched on |
| 2 | Fault reset (rising edge) | Operation enabled |
| 3 | Enable / Disable | Fault present |
| 4 | Reserved | Voltage applied (mains OK) |
| 5 | Reserved | Quick stop active |
| 6 | Reserved | Switch-on inhibited |
| 7 | Reserved | Warning active |
| 8..15 | Manufacturer / reserved | Manufacturer / reserved |
A typical run sequence is to write CMD = 15 (0x000F: forward + enable + no fault reset) once, then toggle CMD = 7 to coast, or CMD = 6 for quick stop.
Commissioning Procedure
- Power the S7-1200 and a single ATV312 only. Disconnect the daisy chain to all other drives.
- Set the drive's Modbus address to 1, baud to 19.2 kbps, parity 8E1.
- Connect TRA / TRB / M to D0 / D1 / Com on the drive.
- Download the TIA Portal project. Observe the
MB_COMM_LOAD.DONEbit. If it remains FALSE, see the troubleshooting matrix below. - Trigger a single read of ETA (address 3201). Verify in the watch table that the value returned is non-zero after the drive is powered up.
- Issue
CMD = 15and a frequency reference of 100 (10.0 Hz). The drive should accelerate; check motor rotation direction. - Add the second drive, set its address to 2, and repeat. Continue until all nine are on-line.
- Enable end-of-line termination on the last drive and on the CB 1241 if it sits at one end of the bus.
Troubleshooting Matrix
| Symptom | Likely Cause | Diagnostic | Corrective Action |
|---|---|---|---|
| MB_COMM_LOAD.DONE never sets; STATUS = 16#8185 | Port HW ID mismatch | Check device configuration HW ID | Recopy HW ID from CB 1241 properties to MB_COMM_LOAD.PORT |
| MB_MASTER.ERROR sets immediately; STATUS = 16#8380 | Slave did not respond, parity/baud mismatch | Verify drive serial parameters | Set drive to 8E1, 19.2 kbps, RTU |
| STATUS = 16#8381 | Modbus CRC error | Check termination and shield bonding | Enable 120 Ω at both ends, ground shield one end only |
| STATUS = 16#8382 | Invalid function or address | Confirm DATA_ADDR is a valid ATV312 address | Re-check 1-based addressing convention |
| STATUS = 16#8383 | Timeout (slave not responding) | Watch drive's tto counter |
Increase tto on drive side; check wiring polarity (A/B swap) |
| Drive trips with SLF after 1-2 minutes | Com timeout exceeded | Set drive parameter tto to 10 s or higher | Reduce polling interval; raise tto |
| All drives return zero response, no error | A/B polarity reversed on trunk | Try swapping TRA/TRB at one end | Re-wire D0↔TRA, D1↔TRB and verify |
| Intermittent errors under VFD load | Common-mode noise coupling | Inspect shield, separation from motor cables | Use shielded twisted pair, separate from VFD output >30 cm |
| STATUS = 16#80A8 | Another Modbus instance already active on this port | Ensure only one MB_MASTER queue per port | Sequence all MB_MASTER calls; do not parallelize |
Performance and Bus Loading
At 19.2 kbps with 8E1 framing, a single Modbus RTU transaction (request + response) for 1-2 registers requires approximately 8-15 ms. Reading 2 registers from all 9 drives sequentially yields a worst-case scan time of about 135 ms, well within the 1 s response budget of the ATV312's tto parameter. If you poll status more frequently (e.g., 50 ms), consider reading only the status word (1 register) and issuing control-word writes only on change. Avoid polling all 9 drives in parallel from multiple MB_MASTER instances — the S7-1200 serial port is half-duplex, and overlapping transactions return 16#80A8.
Variants: CM 1241 and Migration to S7-1500
The wiring scheme and program structure are identical for the CM 1241 RS-485 module (6ES7241-1CH30-0XB0) — only the hardware identifier of the port changes. For new installations, Siemens offers the Modbus TCP solution using MB_CLIENT / MB_SERVER, which requires a CM 1241 Ethernet module plus an Ethernet-to-Modbus gateway on the drive side, or a native Modbus TCP drive such as the ATV340. For multi-drive panels where future migration to S7-1500 is planned, design the drive register map at the gateway layer so the PLC side is transport-agnostic.
Modbus TCP Alternative for the S7-1200
If wiring distance exceeds 50 m, the cabinet has severe EMI, or you need deterministic update below 50 ms, switch to Modbus TCP. The S7-1200 supports MB_CLIENT and MB_SERVER over its PROFINET port without any extra module. The S7-1200 CPU functions as a Modbus TCP server by default, and the MB_CLIENT instruction establishes outbound client connections to up to 8 servers. The reference implementation is documented in the official Siemens Modbus TCP application note (see the link in the previous section).
Field-Proven Caveats
- Schneider's "1-based" Modbus address convention is the most common commissioning error. A request to address 3201 on the wire is actually function code 03 / 0x0C81 — confirm the address map in the drive manual before publishing tags.
- The ATV312's
ttodefault is 1.0 s, which is too short for systems that take longer than one second to complete a full 9-drive poll. Increase to 10 s for safety. - Do not enable bus termination on intermediate drives; only the two physical end-of-line units.
- The CB 1241 cannot be hot-swapped; cycle power if you ever need to reseat it.
- If a drive is powered off while on the bus, the rest of the network continues to function, but the master will accumulate
16#8383timeouts until the drive returns.
What is the difference between CM 1241 and CB 1241 for Modbus RTU?
The CM 1241 is a signal module mounted to the left of the CPU, while the CB 1241 is a signal board mounted under the CPU. Both expose a 6-terminal RS-485 interface and use the same Modbus RTU instruction set. The CB 1241 is cheaper and ideal for single-board builds, while the CM 1241 suits distributed panels.
Which RJ45 pins on the Altivar 312 carry the Modbus signal?
Pin 5 is D0 (A line), pin 4 is D1 (B line), and pin 8 is the Modbus signal common. All other pins are reserved and must remain unconnected. The drive's onboard 120 Ω termination is controlled by the SW1 switch on the front of the unit.
What Modbus address on the S7-1200 corresponds to the Altivar 312 status word?
The ATV312 status word (ETA) is read at Modbus address 3201, and the control word (CMD) is read/written at 8501. Schneider uses 1-based addressing, so request function code 03 with starting address 0x0C81 (decimal 3201) to read the status word.
How do I fix MB_MASTER error 16#8381 (CRC error)?
A CRC error indicates line-quality problems. Enable 120 Ω termination at both ends of the bus, ground the cable shield at one point only, and confirm TRA/TRB polarity matches D0/D1. Inspect for kinked cables or proximity to VFD output wiring.
Can the S7-1200 communicate with Altivar 312 over Modbus TCP instead?
Yes. The S7-1200 CPU supports MB_CLIENT and MB_SERVER on its PROFINET port. The Altivar 312 itself does not have Ethernet, so you need a Modbus RTU/TCP gateway, or migrate to an Altivar 340 (ATV340) which has native Modbus TCP. The Siemens application note at support.industry.siemens.com provides the reference configuration.