Wiring the TM PosInput 1 (6ES7138-6BA01-0BA0) to an S7-1200: Resolving 24V Encoder Signal Compatibility
Migrating a legacy SIMATIC S5 high-speed counter module to a SIMATIC ET 200SP TM PosInput 1 with a modern S7-1200 CPU is not a drop-in replacement. The most common field failure when replacing the 6ES5 385-8MB11 (25/500 kHz counter) with the 6ES7138-6BA01-0BA0 is a signal-level incompatibility: the S5 module accepted 24 V rectangular-wave signals, but the TM PosInput 1 only accepts SSI, RS422 (differential), or TTL (5 V) encoder signals. Wiring the legacy 24 V push-pull encoder directly into the TM PosInput 1 destroys the input stage or simply produces no count.
This reference documents the root cause, the pin assignments of both modules, three engineering solutions, and the verification steps required to commission the replacement correctly in TIA Portal.
1. Problem Context: S5-to-S7 Migration Scenario
The original installation used the following S5 hardware:
- Counter module: Siemens SIMATIC S5 6ES5 385-8MB11 (25/500 kHz high-speed counter)
- Encoder: 24 V rectangular-wave incremental encoder
-
Wiring (from existing documentation):
- Pin 5 – Ground (0 V / M)
- Pin 8 – Supply voltage 24 V DC (encoder power)
- Pin 13 – Rectangular-wave signal A (24 V)
- Pin 14 – Rectangular-wave signal B (24 V)
The planned replacement hardware is:
- Distributed I/O: SIMATIC ET 200SP, PROFINET interface module (e.g. IM 155-6 PN)
- Technology module: TM PosInput 1, order number 6ES7138-6BA01-0BA0
- Controller: SIMATIC S7-1200 (any CPU 1211C / 1212C / 1214C / 1215C / 1217C with PROFINET controller capability)
The hardware was already ordered before the signal-level problem was discovered, so a careful engineering decision is required: the encoder cannot be rewired into the TM PosInput 1 in its current form.
2. Hardware Specifications and Signal Levels
2.1 S5 6ES5 385-8MB11 (Legacy Counter)
| Parameter | Value |
|---|---|
| Counting frequency | 25 kHz / 500 kHz (selectable) |
| Signal input level | 24 V DC (HTL), optically isolated |
| Input channels | 1 counter, 3 digital inputs for gate / set |
| Encoder type | 24 V incremental (rectangular wave A, B, N) |
| Supply | 24 V DC |
2.2 ET 200SP TM PosInput 1 (6ES7138-6BA01-0BA0)
Per the official device manual (chapter 3.3, supported encoder interfaces), the TM PosInput 1 evaluates the following encoder types only:
| Encoder type | Signal level | Differential | Max frequency |
|---|---|---|---|
| SSI | RS422 | Yes | 1 MHz |
| Incremental (RS422) | RS422 / 5 V TTL differential | Yes (A, /A, B, /B, N, /N) | 1 MHz |
| Incremental (TTL) | TTL single-ended 5 V | Optional | 1 MHz |
| 24 V HTL encoder | Not supported | — | — |
2.3 Pin Assignment of the TM PosInput 1 (BaseUnit BU15-P16+A0+2D)
| Terminal | Signal | Description |
|---|---|---|
| 1 | 24 V encoder supply | Encoder power (from BU) |
| 2 | M (0 V) encoder supply | Ground reference |
| 3 | A | Incremental signal A (RS422/TTL) |
| 4 | /A | Inverted signal A (RS422) |
| 5 | B | Incremental signal B (RS422/TTL) |
| 6 | /B | Inverted signal B (RS422) |
| 7 | N | Zero marker N (RS422/TTL) |
| 8 | /N | Inverted zero marker (RS422) |
| 9–12 | DI0 / DI1 / DI2 | Digital inputs (24 V, for gate / latch) |
| 13–16 | DQ0 / DQ1 / 24 V / M | Digital outputs and supply feed |
The 24 V rectangular-wave signal A on Pin 13 of the legacy S5 module is an HTL single-ended 24 V signal. It cannot be terminated on the TM PosInput 1 terminals 3/4 or 5/6 without exceeding the 5 V / RS422 input common-mode range.
3. Root Cause Analysis
The legacy 24 V encoder is electrically incompatible with the TM PosInput 1. Specifically:
- Voltage level mismatch: 24 V high level vs. 5 V (TTL) or RS422 (3.3 V differential) low level.
- Topology mismatch: HTL single-ended push-pull vs. RS422 differential twisted pair.
- Connector mismatch: The S5 used a 24-pin front connector with separate pins for A and B; the ET 200SP uses a BaseUnit push-in terminal with A / /A pairs.
Connecting the 24 V signal A to terminal 3 of the TM PosInput 1 will forward-bias the ESD / line-protection diodes on the input stage and may destroy the receiver. At minimum, the counter will not increment.
4. Three Engineering Solutions
Because the hardware is already on site, three remediation paths are available, ordered by cost and disruption.
4.1 Solution A – Use the S7-1200 Onboard High-Speed Counter (Recommended)
The simplest and least expensive fix is to bypass the TM PosInput 1 entirely and use the S7-1200 CPU's built-in HSC inputs. Every S7-1200 CPU includes 24 V HSC-compatible digital inputs that are electrically matched to the legacy encoder.
4.1.1 HSC capabilities by CPU
| CPU | HSC count | Max frequency (24 V inputs) | Input assignment |
|---|---|---|---|
| CPU 1211C | 6 | 100 kHz single-phase / 80 kHz quadrature | I0.0–I1.5 |
| CPU 1212C | 6 | 100 kHz | I0.0–I1.5 |
| CPU 1214C / 1215C | 6 | 100 kHz | I0.0–I3.5 |
| CPU 1217C | 6 | 1 MHz (differential on-board) | I0.0–I1.5 (1 MHz diff. HSC) |
4.1.2 Wiring of the 24 V Encoder to S7-1200 HSC Inputs
For a 24 V HTL incremental encoder with phases A and B (no zero marker), connect as follows:
| Encoder wire | S7-1200 terminal | Note |
|---|---|---|
| 24 V (encoder power, Pin 8 on S5) | 24 V sensor supply (L+) or 24 V from the same PSU that powers the CPU | Observe polarity |
| Ground (Pin 5 on S5) | M (CPU M terminal, same PSU return) | Common ground mandatory |
| Signal A (Pin 13 on S5) | CPU input Ia.0 (HSC1 phase A) – e.g. I0.0 | Set input filter to 0.8 µs or 6.4 µs |
| Signal B (Pin 14 on S5) | CPU input Ib.0 (HSC1 phase B) – e.g. I0.1 | Quadrature direction |
Shielded twisted-pair cable is recommended, with the shield bonded to the cabinet ground at one end only.
4.1.3 TIA Portal Configuration (Device Configuration)
- Open the S7-1200 CPU in Device View.
- Select Properties → High-speed counters (HSC).
- Add HSC1 with the following parameters:
- Type: Counting
- Operating phase: Two phase (A and B quadrature)
- Counting direction: User program controlled (or hardware gate)
- Initial count value: 0
- Set the input filter for I0.0 and I0.1 to 0.8 µs (for high-speed encoders up to 100 kHz) or 6.4 µs (for lower-speed encoders up to 20 kHz, with better noise immunity).
- Assign HSC1 address, e.g. ID1000 (input process image, 4 bytes).
- Compile and download the hardware configuration.
Reference: S7-1200 Programmable Controller – System Manual, chapter 10.1 (Counting / High-speed counters)
4.1.4 Programmatic Control with CTRL_HSC_EXT
For dynamic reconfiguration of the HSC at runtime (preset value, gate control, etc.), use the CTRL_HSC_EXT technology instruction. Place an instance DB and call the block from OB1 or a cyclic interrupt OB.
ST example for HSC1 with software gate:
// HSC1 software gate control
"HSC1_DB".SW_GATE := TRUE; // open the gate
"HSC1_DB".CTRL := TRUE; // rising edge: apply parameters
// Optional: re-initialise counter to a preset
"HSC1_DB".PV := 0; // preset value
"HSC1_DB".CV := 0; // current value mirror
The current count value is automatically updated in the process image and can be read directly via the configured ID (e.g. %ID1000).
4.2 Solution B – Add a 24 V HTL → RS422 / TTL Signal Converter
If the encoder must remain a 24 V HTL device, install an external signal converter between the encoder and the TM PosInput 1. Typical form factors are Phoenix Contact MINI MCR, Weidmüller WAVESERIES, or Siemens SITRANS interface converters. Select a converter that:
- Accepts 24 V HTL single-ended A and B inputs.
- Outputs RS422 differential signals (A, /A, B, /B).
- Has an input frequency ceiling of at least 1 MHz (matching the TM PosInput 1).
Wiring topology
+-----------+ 24 V HTL +----------------+ RS422 +---------------+
| Encoder | ----------------> | HTL -> RS422 | --------> | TM PosInput 1 |
| (24 V A,B)| Pin 13 -> A_in | signal | A -> 3 | 6ES7138-... |
| | Pin 14 -> B_in | converter | /A -> 4 | |
| | Pin 8 -> 24 V | | B -> 5 | |
| | Pin 5 -> GND | | /B -> 6 | |
+-----------+ +----------------+ +---------------+
Mount the converter in the same cabinet, share the 24 V supply between encoder and converter, and provide separate 24 V for the TM PosInput 1 BaseUnit. The two ground systems should be tied at a single point.
4.3 Solution C – Replace the Encoder with a 5 V TTL / RS422 Version
Mechanical encoders (Hengstler, Kübler, Heidenhain, Sick, ifm) are commonly available with multiple output options. When the existing encoder is due for replacement anyway, order an RS422 or 5 V TTL variant with the same PPR (pulses per revolution) and shaft geometry. The new encoder can then wire directly to the TM PosInput 1 without any converter.
Direct wiring of an RS422 encoder to the TM PosInput 1
| Encoder conductor (typical colour) | TM PosInput 1 terminal |
|---|---|
| Brown – 24 V | 1 (24 V supply) |
| Blue – 0 V | 2 (M) |
| Green – A | 3 (A) |
| Yellow – /A | 4 (/A) |
| White – B | 5 (B) |
| Red – /B | 6 (/B) |
| Grey – N | 7 (N) |
| Pink – /N | 8 (/N) |
Always verify the colour code against the encoder's own data sheet; there is no industry-wide colour standard.
5. Decision Matrix
| Criterion | Solution A (S7-1200 HSC) | Solution B (HTL→RS422 converter) | Solution C (New TTL/RS422 encoder) |
|---|---|---|---|
| Hardware already on site re-usable | Yes (S7-1200 CPU + encoder) | Yes (encoder) | Encoder only |
| TM PosInput 1 usable | No (decommission or use for SSI later) | Yes | Yes |
| Max encoder frequency | 100 kHz (1 MHz only on CPU 1217C) | 1 MHz | 1 MHz |
| Additional cost | €0 | €150–400 | €300–900 (encoder) |
| Wiring complexity | Low | Medium | Low (new pinout) |
| Noise immunity | Good (24 V is robust) | Excellent (differential) | Excellent (differential) |
| Recommended for legacy 24 V encoders | ★★★★★ | ★★★ | ★★★★ (when encoder is end-of-life) |
6. Verification Procedure
After the chosen solution is wired, perform the following checks in order.
- Visual inspection: Confirm 24 V supply and ground polarity at the encoder and at the receiver (CPU or TM PosInput 1).
- Power-on: With the encoder shaft stationary, the counter value must hold steady (no drift).
- Manual rotation test: Rotate the encoder shaft by hand at slow speed. The count value must increment / decrement in the expected direction.\li>
- Frequency test: Spin the encoder at operational speed and use the Trace or Watch table function in TIA Portal to verify the HSC frequency reading against the expected PPR × RPM / 60.
- Direction test: Reverse rotation; verify that HSC direction bit toggles (if the HSC is configured for bidirectional counting).
- Diagnostic LEDs on TM PosInput 1 (if used): The DIAG LED must be solid green; the encoder supply LED indicates 24 V at terminal 1.
- Online & Diagnostics in TIA Portal: Open Online & Diagnostics → Encoder status; check for errors such as wire break, short circuit, or signal level faults.
7. Programming Reference: CTRL_HSC_EXT in Structured Text
The following ST snippet can be pasted into an FB in TIA Portal V17 or later.
// FB_HSC1_Ctrl – runtime control of HSC1
#SW_GATE := TRUE; // open the gate
#PV := 0; // preset value
#RV := 100000; // reference value (not used in count mode)
#CV := 0; // not used; current value auto-updated
#PERIOD := FALSE; // not in period mode
#CTRL := TRUE; // edge-triggered: apply new parameters
// CTRL_HSC_EXT is a technology instruction; insert from the task card
// under "Counting & measuring"; bind to HSC1 instance DB.
For motion-control applications where the encoder value is consumed by a closed-loop axis, also consider the TO_SynchronousAxis / MC_Home blocks from the S7-1200 Motion Control library, configured against the HSC as the encoder source.
8. Troubleshooting Matrix
| Symptom | Probable cause | Diagnostic step | Fix |
|---|---|---|---|
| Count remains 0 | 24 V applied to TM PosInput 1 input; input destroyed | Measure voltage at terminals 3 and 5 with multimeter | Replace TM PosInput 1; use Solution A or signal converter |
| Count drifts when stationary | Input filter set too fast, picking up noise | Change filter to 6.4 µs in TIA Portal | Add shielded cable; tie shield at one end only |
| Count increments but direction is wrong | Phase A and B swapped | Swap wires on terminals 3/5 or 0.0/0.1 | Reverse A and B in wiring |
| DIAG LED on TM PosInput 1 flashing red | Wire break or signal below threshold | Open Online & Diagnostics | Check encoder supply; check continuity of A, B pairs |
| Counts sporadically on TM PosInput 1 only at high RPM | Encoder is HTL; signals clipped at receiver | Scope terminals 3 and 4 | Install HTL→RS422 converter or change encoder |
| CPU reports "Hardware fault – HSC not ready" | HSC input filter set to 0.8 µs but frequency > 100 kHz | Calculate pulses per second | Reduce PPR, use CPU 1217C for 1 MHz HSC, or add external counter module |
| Count works in OB1 but value always 0 in Watch table | Process image address wrong | Cross-check IDW address in device configuration | Read from configured IDW, not from %MW |
9. Field-Proven Engineering Caveats
- Single-ended TTL wiring is acceptable but not recommended. The TM PosInput 1 expects differential RS422; using only A and B without /A and /B works at low frequencies but is susceptible to common-mode noise in industrial cabinets. Always wire the /A and /B pairs if the encoder provides them.
- Encoder supply sharing. The TM PosInput 1 BaseUnit (BU15-P16+A0+2D) supplies 24 V at terminal 1, but this supply has a current limit (typically 500 mA). Verify that the encoder's consumption plus any other loads on the same BU do not exceed the limit.
- PROFINET update time. The TM PosInput 1 must be placed on a PROFINET network with a cycle time compatible with the required position update. For motion applications use 1 ms; for simple counting 4 ms is sufficient.
- CPU 1217C differential HSC. If the encoder output is RS422 and the S7-1200 HSC is preferred, the CPU 1217C supports 1 MHz differential HSC on its first four HSC inputs (I0.0 / I0.1, I0.2 / I0.3, I0.4 / I0.5, I0.6 / I0.7). The 24 V input is automatically disabled in differential mode.
- G3 (Generation 2) CPU note. S7-1200 G2 CPUs (e.g. CPU 1212C DC/DC/DC, 6ES7212-1AE40-0XB0 and later) have updated HSC channel mapping. Always re-check the pinout in the TIA Portal device configuration before wiring the encoder.
10. Summary of Recommended Path
For a brownfield migration of an S5 6ES5 385-8MB11 with a 24 V HTL encoder to a modern SIMATIC architecture centred on an S7-1200, the lowest-risk path is Solution A:
- Keep the existing 24 V encoder.
- Wire A and B to the S7-1200 CPU HSC inputs (I0.0 and I0.1 by default).
- Configure HSC1 in TIA Portal as a two-phase quadrature counter.
- Decommission or repurpose the ET 200SP TM PosInput 1 for a future SSI absolute encoder application.
The TM PosInput 1 is not the correct technology module for a 24 V HTL signal source. Attempting to use it as such either damages the module or produces a non-functional system. The S7-1200 onboard HSC, the 24 V HTL signal converter, and a TTL/RS422 encoder are the only three valid wiring paths.
Can the TM PosInput 1 (6ES7138-6BA01-0BA0) read a 24 V rectangular-wave signal?
No. The TM PosInput 1 supports SSI, RS422 differential, and 5 V TTL incremental encoders only. Connecting a 24 V HTL signal will damage the input stage or cause no counts to be registered. Use the S7-1200 CPU onboard HSC, an HTL→RS422 converter, or replace the encoder with a 5 V TTL / RS422 unit.
What is the maximum counting frequency of the S7-1200 onboard HSC?
Up to 100 kHz on standard CPUs (CPU 1211C / 1212C / 1214C / 1215C) and up to 1 MHz differential on the CPU 1217C. Set the input filter to 0.8 µs for high-speed applications and to 6.4 µs for noise-prone environments up to 20 kHz.
Which pin of the S7-1200 should the encoder phase A connect to for HSC1?
HSC1 phase A is hard-wired to I0.0 and phase B to I0.1 on every S7-1200 CPU. For HSC2 use I0.2 / I0.3, for HSC3 use I0.4 / I0.5, and so on. These assignments are fixed by the CPU and cannot be remapped.
Does CTRL_HSC_EXT replace the hardware HSC configuration?
No. The HSC must first be enabled and configured in the device configuration (counting mode, initial value, gate logic, input filter). CTRL_HSC_EXT only modifies selected parameters at runtime, such as preset value, current value, and gate state. See chapter 10.1 of the S7-1200 system manual for details.
Can the ET 200SP TM PosInput 1 be replaced with a different technology module that supports 24 V encoders?
Within the ET 200SP family there is no native 24 V HTL counter module. Either use a SIMATIC S7-1500 / ET 200MP TM Count 2×24V (6ES7550-1AA00-0AB0, 200 kHz HTL) with an S7-1500 CPU, add a 24 V HTL counter module such as a 1Count 24V (6ES7138-6AA00-0BA0) for the ET 200SP, or use the S7-1200 onboard HSC as documented in this article.