1. Problem Overview and Scope
Three weighing machines must report their measured values to a SIMATIC S7-1500 CPU 1513-1PN through a single point-to-point communications module, the CM PtP RS422/485 HF (order number 6ES7541-1AB00-0AB0). The weighing instruments transmit their data frames cyclically using the ASCII-based FreePort protocol; the PLC must receive, demultiplex by source, and expose the three values for downstream automation. Two of the devices are SIPAC load-cell viewers and one is an IP2 viewer; all three are wired into a single RS-485 multidrop line through an interconnection (T-branch) box.
The principal engineering challenges are:
- Reconstructing a multi-master FreePort stream on one RS-485 segment.
- Distinguishing which weighing device emitted a given frame (header / preamble ID).
- Configuring the CM PtP HF character frame, receive buffer and handshake correctly.
- Implementing a robust receive state machine in TIA Portal (SCL or LAD) that never drops a frame at the buffer boundary.
This article compiles the considerations, the recommended architecture, the parameter set and a working SCL program skeleton.
2. Hardware Identification and Module Specifications
The communications module referenced in the source is the CM PtP RS422/485 HF with article number 6ES7541-1AB00-0AB0. The successor variant 6ES7541-1AB01-0AB0 has identical pinning and a functionally compatible instruction set; firmware 2.x of the AB01 ships with the S7-1500 / ET 200MP manual collection available on the TIA Portal documentation portal. Both are documented in the device manual that complements the S7-1500 system manual.
| Parameter | CM PtP RS422/485 HF value |
|---|---|
| Article number (as installed) | 6ES7541-1AB00-0AB0 |
| Successor article | 6ES7541-1AB01-0AB0 |
| CPU slot compatibility | S7-1500 / ET 200MP backplane |
| Electrical interfaces | RS-422 (4-wire full-duplex) or RS-485 (2-wire half-duplex) |
| Max. number of CMs per station | Limited by slot count; for FreePort use one CM per RS-485 segment to avoid collision |
| Protocols supported | FreePort (ASCII), 3964(R), Modbus RTU (master/slave), USS |
| Baud rate range | 300 bit/s to 115.2 kbit/s |
| Receive buffer (HF) | 2048 bytes per port |
| Transmit buffer (HF) | 2048 bytes per port |
| Max. cable length (RS-485) | 1200 m at ≤ 93.75 kbit/s; derate above |
| Galvanic isolation | Yes (against backplane) |
| Configuration tool | TIA Portal V15.1 or later; recommended V18 for HF firmware ≥ 2.0 |
6ES7540-1AB01-0AA0) is limited to a 224-byte buffer and is unsuitable for buffered reception of multiple weighing frames. Always deploy HF for this kind of multidrop receiver application.3. RS-485 Multidrop Topology and Cabling
RS-485 is a differential bus standard that permits up to 32 unit loads on a single twisted pair (T(A)/T(B)) with an optional second twisted pair for full-duplex (R(A)/R(B)). For the weighing application, half-duplex 2-wire mode is sufficient because traffic is one-directional: each weighing viewer transmits, the PLC listens.
3.1 Cable type
Use a shielded data cable with twisted pairs, Siemens recommends LIYCY 3 × 2 × 0.14 (3 pairs × 0.14 mm²). The T(A)/T(B) pair must be twisted together, and any R(A)/R(B) used for full-duplex must be twisted separately. The third pair (or a spare conductor) is typically bonded to chassis ground at one end only.
3.2 Termination
Both physical ends of the RS-485 bus must be terminated with 120 Ω between T(A) and T(B). The CM PtP exposes a switchable internal termination; activate it when the module sits at one end of the line. The weighing viewer farthest from the PLC must have its own 120 Ω termination (usually a DIP switch inside the device or a resistor soldered on the backplane). Failure to terminate produces reflection-induced framing errors (NACK/CRC mismatches) that are often misdiagnosed as electrical noise.
3.3 Topology sketch
Two SIPAC viewers and the IP2 viewer all wire into the same T-branch. Each viewer is configured with its own unique ASCII header so the PLC can demultiplex.
4. FreePort Character Frame Configuration
In TIA Portal the CM PtP HF is parameterized under Device configuration → Properties → RS422/485 interface → Port configuration → Protocol selection = "Freeport (ASCII)". The following table is a typical starting point; always verify against the weighing device manual.
| Parameter | Typical value | Comment |
|---|---|---|
| Protocol | Freeport | ASCII, no 3964 handshake |
| Baud rate | 9600 bit/s | Default for most industrial viewers; verify on each device |
| Data bits | 8 | ASCII printable + STX/ETX |
| Parity | None | Use "Even" if device manual requires it |
| Stop bits | 1 | 2 stop bits if parity = None is not supported on the device |
| Flow control | None | Half-duplex 2-wire RS-485 |
| Initial receive state | Active | CM listens immediately after RUN |
| End-of-frame criterion | Character delay time (Tgap) | Default 4 × character time; raise if slow CPU |
| Break detection | Enabled | Useful for warm-restart detection |
| RTS control | Always OFF | RS-485 direction control: hardware automatic |
The "end of frame" detection is critical. With FreePort the CM PtP closes a frame when one of these conditions fires:
- Number of received bytes ≥ configured length.
- Character gap (Tgap) elapsed since last byte.
- Configured termination character received (e.g. CR, LF, ETX).
Most weighing viewers append CR + LF after the data string. Configure the CM to terminate on the LF character (ASCII 0x0A). This makes the receive logic deterministic and removes the need to compute Tgap.
5. Header Identification Strategy
Because the three weighing viewers all share a single RS-485 segment and are not polled, their frames arrive interleaved on the wire. The PLC must therefore identify the source by inspecting a header that is unique per device. Two strategies are common:
5.1 Fixed-position header
Each viewer prefixes its frame with a fixed-length ASCII token. For example:
$S1,+012.345,kg,ST,OK<CR><LF> <-- SIPAC #1
$S2,+000.987,kg,ST,OK<CR><LF> <-- SIPAC #2
$IP2,+025.500,kg,ST,OK<CR><LF> <-- IP2 viewer
The CM is configured with a frame length ≥ the longest expected payload (e.g. 32 bytes). On every LF-terminated frame the parser reads the first 3 characters and routes accordingly.
5.2 Variable-length preamble / wildcard
If the viewer cannot be reprogrammed to emit a unique header, configure it to inter-message delay (Tgap) such that the receiver treats each frame independently. This is more fragile because a missed LF causes the next frame to be appended to the previous one. Always prefer fixed-position headers.
6. Receive_P2P Block Configuration
The CM PtP HF exposes its data through the standard Siemens PtP instruction set. The two blocks used in this application are:
| Instruction | Direction | Use here |
|---|---|---|
Receive_P2P (FB 1196, instance DB required) |
Receive | Continuously accepts bytes into the buffer |
Send_P2P (FB 1195) |
Send | Optional, only if the PLC must send commands |
Receive_Reset (FB 1198) |
Control | Flush the receive buffer on overrun |
PtP_GetAttributes / PtP_SetAttributes
|
Diagnostic | Read baud, parity, status |
Place Receive_P2P in OB1 with a fixed instance DB. Wire the parameters as follows:
| Input | Value | Notes |
|---|---|---|
REQ |
Always TRUE or controlled by tag | Hold enabled during cyclic receive |
PORT |
~CM_PtP_HF HW identifier |
Found under "System constants" in TIA |
BUFFER |
Data block in PLC (array of BYTE) | At least 512 bytes recommended |
LEN |
Local tag, returns bytes received | Reset on consumption |
EN_R |
TRUE | Enable receive |
R |
Reset tag (rising edge) | Used after parser failure |
LADDR |
Hardware ID of port | Drop-down in TIA |
STATUS / ERROR
|
Word tags | Monitor in HMI |
6.1 Sample instance DB
DATA_BLOCK "DB_WeighRx"
STRUCT
hdr : STRING[3]; // 3-char header ("S1", "S2", "IP2")
value : STRING[10]; // ASCII weight incl. sign and decimal
unit : STRING[3]; // "kg"
status : STRING[2]; // "OK" / "ER"
filler : STRING[1]; // comma or delimiter
source : INT; // 1, 2 or 3 (decoded from hdr)
valid : BOOL; // TRUE when frame has been parsed OK
timestamp: DTL; // PLC time at parse instant
END_STRUCT;
END_DATA_BLOCK
7. Frame-Parser State Machine in SCL
Because the receiving CM terminates the frame on LF, every call to Receive_P2P returns at most one complete weighing message. A small SCL block can therefore operate on the frame as a unit. The state machine below is a conservative implementation that:
- Searches for the configured length / LF.
- Validates the header token.
- Converts the ASCII value to REAL.
- Stamps the value with a DTL timestamp and source ID.
FUNCTION_BLOCK "FB_WeighParse"
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
VAR_INPUT
i_hwId : HW_IO; // port HW identifier
i_tickMs : INT; // OB1 cycle time in ms (e.g. 10)
END_VAR
VAR_OUTPUT
o_weig1 : REAL; // SIPAC #1, kg
o_weig2 : REAL; // SIPAC #2, kg
o_weig3 : REAL; // IP2 #3, kg
o_sts : WORD; // 16-bit aggregated status
o_overrun : BOOL; // buffer overrun latch
END_VAR
VAR
instRx : Receive_P2P; // instance DB auto-generated
rxBuf : ARRAY[0..511] OF BYTE;
rxLen : INT;
txFrame : ARRAY[0..63] OF BYTE;
hdrStr : STRING[3];
valStr : STRING[10];
unitStr : STRING[3];
staStr : STRING[2];
i : INT;
j : INT;
r : REAL;
gapCnt : INT; // counts watchdog ticks
END_VAR
BEGIN
// 1. Watchdog: if no byte arrived for > 5 s, flush partial frame
gapCnt := gapCnt + i_tickMs;
IF gapCnt > 5000 THEN
"Receive_Reset"(REQ := TRUE, LADDR := i_hwId, ID := 0);
o_overrun := TRUE;
gapCnt := 0;
END_IF;
// 2. Always call Receive_P2P - it is non-blocking
"instRx"(REQ := TRUE,
LADDR := i_hwId,
PORT := i_hwId,
BUFFER := rxBuf,
LEN := rxLen,
EN_R := TRUE,
R := FALSE,
STATUS := o_sts,
ERROR => o_sts);
IF rxLen < 6 THEN RETURN; END_IF; // too short
IF rxBuf[rxLen - 1] <> 16#0A THEN RETURN; END_IF; // last byte = LF
gapCnt := 0; // frame completed
// 3. Decode header (assume ASCII printable, byte 0..2)
hdrStr := '';
hdrStr := CONCAT(IN1 := CHAR_TO_STRING(BYTE_TO_CHAR(rxBuf[0])),
IN2 := CHAR_TO_STRING(BYTE_TO_CHAR(rxBuf[1])));
hdrStr := CONCAT(IN1 := hdrStr,
IN2 := CHAR_TO_STRING(BYTE_TO_CHAR(rxBuf[2])));
// 4. Walk bytes to extract value field (between first comma and second)
valStr := ''; j := 0;
FOR i := 3 TO rxLen - 2 DO
IF rxBuf[i] = 16#2C THEN // comma
EXIT;
END_IF;
valStr := CONCAT(IN1 := valStr,
IN2 := CHAR_TO_STRING(BYTE_TO_CHAR(rxBuf[i])));
END_FOR;
// 5. Convert ASCII value to REAL
r := STRING_TO_REAL(valStr);
// 6. Route by header
IF hdrStr = 'S1' THEN o_weig1 := r;
ELSIF hdrStr = 'S2' THEN o_weig2 := r;
ELSIF hdrStr = 'IP2' THEN o_weig3 := r;
END_IF;
// 7. Acknowledge by zeroing length
rxLen := 0;
END_FUNCTION_BLOCK
Receive_P2P in a cyclic OB (OB1) so that it polls the CM continuously; the parser can sit in the same OB or be called from a faster OB30 interrupt if frames arrive at > 100 Hz. Do not call Receive_Reset in OB1 every cycle — gate it with the watchdog condition shown above.8. Buffer Management and Watchdog Strategy
The CM PtP HF receive buffer is 2048 bytes. At 9600 bit/s a weighing frame of 32 bytes occupies roughly 26.6 ms of airtime. If the three viewers all transmit within 30 ms of each other, the PLC must have processed the first frame before the third finishes, otherwise the third overruns the buffer. Two defensive measures prevent data loss:
- Inter-frame watchdog. The parser decrements a counter that resets on every successful frame. If it expires (5 s is a sane default), the buffer is flushed and a "buffer-overrun" event is raised to the HMI/SCADA layer.
- Cyclic parsing in a fast OB. Use OB30 (e.g. 5 ms) so that each frame is drained from the FIFO within a few milliseconds of arrival.
-
Length pre-check. If the configured maximum frame length is exceeded, the CM raises STATUS =
0x0007(buffer full / overflow). The application must reset and log.
9. Alternative Architectures
If the weighing viewers cannot be configured to use unique headers, three alternative architectures apply. Each has cost and engineering trade-offs.
| Architecture | Pros | Cons |
|---|---|---|
| Single CM + unique headers (recommended) | Lowest hardware cost; deterministic demultiplex | Requires viewer configuration access |
| Three CM PtP HF modules, one per viewer | Independent receive buffers; no demultiplex code | 3 × CM module cost; 3 × slot occupancy |
| RS-232/485-to-TCP adapters on PROFINET | Native TCP_PUT / TCP_GET on S7-1500; isolation per device | Extra adapters; small latency overhead |
| ET 200MP station with HF modules distributed | Long cable runs tolerated | More cabinet space and PROFINET bandwidth |
For most weigh-cell installations with < 50 m cable run and a programmable viewer, the first option (single CM, header-based demultiplex) is the engineering sweet spot.
10. Commissioning and Verification
- Wiring check. With the PLC in STOP, measure 60–80 Ω between T(A) and T(B) at the CM end (two 120 Ω in parallel through the line) and 120 Ω at the far viewer. If you read open or 240 Ω, one termination is missing.
- Frame integrity check. Use the CM's online diagnostic in TIA Portal (Online & diagnostics → Functions → Receive buffer). Force each viewer to emit and confirm the captured buffer matches the expected ASCII string.
-
Watchdog test. Disconnect one viewer and verify that the watchdog raises
o_overrunafter 5 s and the remaining two values continue to update. -
Tag consistency check. Force each output tag (
o_weig1,o_weig2,o_weig3) with a known reference weight and confirm HMI display ±1 LSD (least-significant digit). -
Status monitoring. Add the
STATUSandERRORoutputs ofReceive_P2Pto a diagnostic screen. Common values:
| STATUS / ERROR | Meaning | Action |
|---|---|---|
0x0000 |
No error | None |
0x0001 |
Frame length exceeded | Increase BUFFER size or check viewer |
0x0007 |
Receive buffer full | Call Receive_Reset; investigate parser |
0x0008 |
Parity / framing error | Check baud, parity, cable shielding |
0x0014 |
Hardware fault (line break / short) | Inspect wiring; check 24 V supply to viewer |
0x7000 |
Busy / no frame ready | Normal — no action |
11. Troubleshooting Matrix
| Symptom | Likely cause | Diagnostic step |
|---|---|---|
| No frames captured at all | RS-485 polarity swap (T(A)/T(B) crossed) | Swap wires at the interconnection box; verify differential voltage on scope |
| Frames captured with wrong values | Viewer at wrong baud or parity | Use PtP_GetAttributes to log effective parameter set |
| One viewer silent, others OK | Termination at far end blocking the line | Measure T(A)/T(B) to T(A)/T(B); should be ~60 Ω total |
| Intermittent CRC-like errors | EMI from VFD or welder nearby | Move cable away; add ferrite; check shield bonding at one end only |
| Values stuck on first reading | Parser never resets rxLen after bad frame |
Insert debug tag to monitor rxLen; add explicit reset on parse fail |
STATUS = 0x0007 (overflow) |
Parser slower than line; OB1 cycle too long | Move parser to OB30 with shorter period |
| Header always reads "???" | Header bytes lost (split across buffer boundary) | Increase BUFFER size or use cyclic "header first" search before LF |
12. Field-Proven Caveats
- The Siemens "Freeport" instruction set in TIA Portal is per-port. You cannot bind two viewers with different baud rates to the same physical port.
- The CM PtP HF generates a directional control signal (RTS) automatically for 2-wire RS-485 mode. Do not route RTS to a digital output — the firmware controls it directly. Routing it manually breaks half-duplex turnaround.
- The CM PtP HF supports a maximum of 32 devices on the bus (32 unit loads). All Siemens CM modules count as 1 unit load; third-party weigh viewers must declare their own unit load in their datasheet.
- The instruction set names changed in TIA V16. If migrating an existing project from V15 to V18, the FB instance names
Receive_P2P,Send_P2Premain but the multi-instance DB layout shifts. Recompile and re-download. - When using the CM PtP with a SIMATIC Memory Card removed, configuration persists in the project but the CM retains the last project parameters in flash; cycle power before reading the true config.
13. Reference Documentation
- CM PtP RS422/485 BA / HF (6ES7540-1AB01 / 6ES7541-1AB01) — TIA Portal manual collection (S7-1500 / ET 200MP)
- CM PtP RS422/485 HF (6ES7541-1AB00) — Device Manual (PDF)
Can I connect three weighing machines to a single CM PtP RS422/485 HF?
Yes — provided the three viewers share the same baud rate, parity, data bits and stop bits, and at least two of the three can be configured to emit a unique ASCII header so the PLC can demultiplex frames on the same RS-485 segment. If configuration access is not possible, install one CM PtP HF per viewer.
Which FreePort configuration should I use for SIPAC and IP2 weighing viewers?
Start with 9600 bit/s, 8 data bits, no parity, 1 stop bit and end-of-frame = LF (0x0A). Confirm against the device manual; some weigh viewers require even parity and 2 stop bits instead. Verify with the TIA Portal "Online & diagnostics → Receive buffer" tool before connecting the PLC program.
How large must the receive buffer be for three weighing machines?
The CM PtP HF hardware buffer is 2048 bytes, which is more than enough. The PLC-side BUFFER for Receive_P2P should be sized at 512 bytes minimum so that frame boundaries are never crossed inside a half-loaded buffer. A too-small PLC buffer causes STATUS = 0x0007 (overflow) on busy lines.
What termination resistors are required on the RS-485 multidrop line?
Place a 120 Ω resistor between T(A) and T(B) at each physical end of the bus — typically at the CM PtP (activate its internal switch) and at the last weighing viewer farthest from the PLC. The middle device should not be terminated. With three devices on a short line the two end terminations are sufficient.
What does STATUS 0x0007 from Receive_P2P mean?
The PLC-side receive buffer is full — the application has not consumed the previous frame fast enough. Move the parser to a faster OB (OB30, e.g. 5 ms), call Receive_Reset on a rising edge, and raise an HMI alarm so the operator can investigate cable length or scan-rate mismatches.