1. Application Overview
The 1 Count 24V/100kHz module (Siemens order number 6ES7 138-4DA04-0AB0) is a single-channel counter slice for the ET 200S distributed I/O system. When mounted on a Profibus DP slave driven by an S7-300 master CPU, it provides a cost-effective way to read incremental encoders for material handling positioning tasks — for example, a transport skip that must stop at fixed stations along a conveyor or monorail line.
This reference covers the typical architecture used in such applications:
- Master CPU: 6ES7 315-2AG10-0AB0 (CPU 315-2DP)
- Profibus DP slave interface: 6ES7 151-1AA03-0AB0 (IM151 Standard)
- Counter module: 6ES7 138-4DA04-0AB0 (1 Count 24V/100kHz)
- Incremental encoder: 360 PPR, dual-channel A/B, 24 V push-pull, mounted on the motor shaft
- Actuator: AC motor driven by a VFD, speed reference 4–20 mA from an ET 200S analog output
Because the 1 Count module only produces digital switching signals and a count value, the position control loop must be implemented in the user program. The PLC reads the live count, decides whether the skip is in the fast-approach, creep, or stop zone, and writes an analog value (0–27648 mapped to 4–20 mA) back to the VFD speed reference.
2. Hardware Architecture and Profibus Topology
The ET 200S station is a Profibus DP-V0 slave. With a Standard IM151 (6ES7 151-1AA03-0AB0) the maximum number of electronic modules is limited (8 modules on older revisions, 12 on later firmware). The 1 Count module occupies one slot and must be inserted behind a digital or analog input module that supplies the 24 V power segment — physically it always sits in a powered slot of the terminal block.
| Component | Order Number | Role |
|---|---|---|
| CPU 315-2DP | 6ES7 315-2AG10-0AB0 | Profibus DP master, executes position control |
| IM151 Standard | 6ES7 151-1AA03-0AB0 | ET 200S Profibus slave interface |
| 1 Count 24V/100kHz | 6ES7 138-4DA04-0AB0 | Incremental encoder counter |
| TM-E terminal module | 6ES7 193-4CA40-0AA0 (typical) | Backplane and I/O terminals for the counter |
| 2AO U/I analog output | 6ES7 135-4FB01-0AB0 (typical) | Drives 4–20 mA speed reference to VFD |
| DO module | 6ES7 132-4BD01-0AA0 (typical) | Provides drive enable signal to VFD |
Topology diagram (Profibus DP, RS-485, 1.5 Mbps typical):
3. Module Specifications: 1 Count 24V/100kHz vs FM 350-1
The 1 Count 24V/100kHz is the right choice for slow-to-medium speed positioning on 24 V encoder signals. For higher-speed or 5 V (RS-422) encoders the FM 350-1 is required.
| Parameter | 6ES7 138-4DA04-0AB0 (ET 200S 1 Count 24V/100kHz) | 6ES7 350-1AH03-0AE0 (FM 350-1) |
|---|---|---|
| Counting inputs | 1 channel, A/B (90°) or A | 8 channels (counter mode) |
| Max count frequency | 100 kHz | 500 kHz |
| Signal level | 24 V (Type 3 / IEC 61131-2) | 24 V and 5 V (RS-422) |
| Encoder supply | 24 V / 200 mA from terminal module | 5 V / 24 V selectable per channel |
| Counter width | 32 bits | 32 bits |
| Function blocks | SFB/FC from Siemens example project | Integrated FB range (CNT_CTL, CNT2_WR, etc.) |
| Mounting | ET 200S terminal module, distributed | Central S7-300 rack only |
| Suitable for the 360 PPR / 60 rpm task | Yes (oversized) | Yes (overkill) |
For an incremental encoder at 60 rpm with 360 pulses per revolution the maximum pulse rate is:
f_max = (n × PPR) / 60 = (60 × 360) / 60 = 360 Hz per channel
With quadrature (×4) decoding the module sees:
f_count = 360 Hz × 4 = 1.44 kHz
This is more than two orders of magnitude below the 100 kHz limit of the 1 Count module. There is no risk of frequency overload, so the ET 200S module is fully suitable. The same conclusion holds for the higher 10 kHz HSC integrated in a CPU 312C, which would also handle the signal comfortably.
4. Wiring and Terminal Assignment
The 1 Count 24V/100kHz module is wired through its TM-E terminal module. The encoder cable shield must be terminated at the grounding bar of the ET 200S station to keep common-mode noise off the 24 V inputs.
| Terminal (typical TM-E) | Signal | Encoder Wire | Description |
|---|---|---|---|
| 1 | 24 V encoder supply (out) | Red (V+) | 200 mA, short-circuit proof |
| 2 | 0 V encoder supply | Black (GND) | Must be referenced to ET 200S ground |
| 3 | Input A | White | Count input, 24 V Type 3 |
| 4 | Input B | Green | Direction / 90° phase-shifted |
| 5 | Input Z (marker) | Yellow | Optional reference pulse |
| 6 | DI (gate / enable) | — | Optional hardware gate |
| 7 | DO 0 (compare) | — | Output: count = compare value |
| 8 | DO 1 (direction / ready) | — | Configurable status output |
Use a shielded, twisted-pair cable (LiYCY 4×2×0.34 mm² typical) between the encoder and the ET 200S. Ground the shield on the cabinet side only, with a 360° low-impedance connection to the backplane.
5. STEP 7 / TIA Portal Configuration
The 1 Count 24V/100kHz module is configured in HW Config (STEP 7 V5.x) or in the device configuration of TIA Portal. The module occupies 4 bytes of input and 4 bytes of output in the Profibus I/O image. After insertion, double-click the module to open its properties dialog.
- Open the hardware catalog → ET 200S → Counter modules → 1 Count 24V/100kHz (6ES7 138-4DA04-0AB0).
- Drag the module to the ET 200S station; assign Profibus address (default 3).
- Open the module properties and set:
- Operating mode: Continuous counting
- Signal evaluation: Rotary encoder with single evaluation, double evaluation, or quadruple evaluation (use quadruple for 360 PPR to get 1,440 counts per revolution).
- Gate function: Software gate (controlled by user program, e.g. SFB/FC SW_GATE)
- Count direction: Up/down (controlled by channel B phase)
- Compare value 1: creep-distance position (e.g. 500 counts before target)
- Compare value 2: stop position (e.g. 1,000 counts = target)
- Compile and download HW Config to the CPU. The module's I/O addresses (for example, IB 100–IB 103 / QB 100–QB 103) are now visible in the symbol table.
The user program reads the count value from the input area and the compare status from the output area. With the Standard IM151 (6ES7 151-1AA03-0AB0) the data interface is not modified relative to the older IM151-1; if the project is migrated to a newer IM151-1 HF (6ES7 151-1BA02-0AB0 or 6ES7 151-1CA00-0AB0) the user data layout may shift, which causes SFC/SFB access to read the wrong bytes.
6. User Program: Reading the Count and Driving the VFD
A typical position-control block in STEP 7 has the structure shown below. The simplified STL is for illustration; in production code use FBs in CFC/SCL or a dedicated function block from the Siemens example project linked at the end of this article.
// OB1 - Cyclic position control
// Inputs
// IW 100 = count value (DINT 32-bit)
// I 104.0 = encoder gate status
// Outputs
// QW 100 = compare status / control byte
// QW 200 = 4-20 mA speed reference (0..27648)
// Internal tags
// "Target" = DINT, final stop position in counts
// "Creep" = DINT, position to start creep
// "vFast" = INT, analog value for fast speed (e.g. 25000)
// "vCreep" = INT, analog value for creep speed (e.g. 6000)
CALL FC 100 // "Position_Control" FB
iCount := IW100 // current count from 1 Count module
iTarget := "Target" // e.g. 10000 counts
iCreep := "Creep" // e.g. 8000 counts
iFast := "vFast" // analog 4 mA equiv. = 0, 20 mA = 27648
iCreepV := "vCreep"
qAnalog := QW200 // to 2AO module
qEnable := Q 124.0 // drive enable DO
END_CALL
Inside FC 100 the decision logic is a single subtraction plus a comparator:
L #iCount
L #iTarget
-D // delta = current - target (abs taken)
T #delta // distance to target
L #delta
L #iCreep // creep entry offset
>I // delta > creep offset ?
= #isFast
L #isFast
JCN CREEP
L #iFast
T #qAnalog // fast speed (e.g. 4 mA = 6 mA offset + span)
JU END
CREEP:L #iCreepV
T #qAnalog // creep speed
END: NOP 0
The hysteresis between fast and creep bands must be greater than the count per millisecond at the maximum approach speed, otherwise the output will chatter. A simple check:
counts_per_ms = (v_max_rpm × PPR × 4) / (60 × 1000) = (60 × 360 × 4) / 60,000 = 1.44 counts/ms
A 50 ms scan plus 1.44 counts/ms means the count can change by ~72 counts between scans, so the creep band should be at least 200–500 counts wide for reliable switching.
7. Speed Profile: Fast Approach, Creep, Stop
The reference application calls for a 4–20 mA command with two discrete speed levels:
| Phase | Condition | Speed Reference | Drive Enable |
|---|---|---|---|
| Idle | No move request | 0 mA (0 raw) | OFF |
| Fast | |current − target| > creep_offset | 20 mA (27648) — or trim to motor rated | ON |
| Creep | 0 < |current − target| ≤ creep_offset | ~5 mA (≈ 6000 raw) — gives slow approach | ON |
| Stop | |current − target| ≤ 2 counts AND velocity ≈ 0 | 0 mA (0 raw) | OFF after dwell |
The 4–20 mA scale is mapped to the S7 analog output raw range 0..27648:
I_out (mA) = (4 mA) + (raw / 27648) × 16 mA
For creep at 5 mA: raw = (5 − 4) / 16 × 27648 = 1728. For fast at 18 mA: raw = (18 − 4) / 16 × 27648 = 24192. Adjust these values to match the VFD's minimum and maximum speed scaling, and always clamp the raw value in the user program with a LIMIT 0..27648 to avoid saturating the analog output above 20 mA.
8. Commissioning Procedure
- Hardware check: verify that the IM151 powers up, that the 1 Count module sits in a powered terminal block, and that the 24 V encoder supply is present on terminal 1–2 (measure with a multimeter before connecting the encoder cable).
- Profibus check: from STEP 7, use PLC → Monitor/Modify to confirm the slave is online and no diagnostic interrupt is pending. SF (red) and BF (red) LEDs on the IM151 must be off.
-
Encoder test: with the drive disabled, manually rotate the encoder shaft and watch the count value (e.g.
IW 100in VAT) increment and decrement. If the value remains at 0, see the troubleshooting matrix below. - Direction test: confirm that positive motor rotation produces a positive count increment; if reversed, swap channels A and B at the terminal module or invert the direction bit in the module properties.
- Compare value test: temporarily set the creep_offset to a value you can reach by hand, move the encoder slowly past that count, and verify DO 0 (compare output) toggles in the VAT table.
- Analog ramp test: with the drive enabled and the VFD in remote mode, force the analog output to 0, then to 27648, and confirm the VFD displays the expected speed. Run the S7 program in single-step to walk the skip through one position cycle.
- Full cycle test: trigger a move, observe that the skip reaches fast speed, transitions to creep at the correct position, and stops within ±1 count of the target. Log the count trace for later optimization.
9. Troubleshooting Matrix
| Symptom | Likely Cause | Diagnostic | Corrective Action |
|---|---|---|---|
| Count remains at 0 when encoder rotates | Encoder supply missing or reversed | Measure 24 V across terminal 1–2 | Check terminal module wiring, replace TM-E if 24 V rail is open |
| Count remains at 0 when encoder rotates | Wrong slot — module inserted in unpowered position | Check power segment modules to the left of the counter | Add PM-D or PM-E power module before the 1 Count module |
| Count remains at 0 when encoder rotates | Encoder output type incompatible (NPN into PNP-only input) | Read encoder datasheet, measure output with scope | Use push-pull / PNP sourcing encoder, or wire with external pull-up |
| Count increments but does not decrement | Channel B not connected or broken | Tap channel B with 24 V, observe count direction | Re-terminate B wire, check for open circuit |
| Count wraps unexpectedly | Counter range interpreted as 16-bit | Inspect VAT format (DEC vs INT) | Display as DINT; module is 32 bits, range −2,147,483,648 to 2,147,483,647 |
| Compare output never fires | Compare value not loaded into module | Inspect QB 100 in VAT after download | Reload compare values via the Siemens example FB (CV_LOAD) |
| Position drifts between moves | Encoder slipping, mechanical backlash, or no Z pulse used for homing | Run a known-distance move and compare to expected count | Add homing routine that uses the Z reference pulse to re-zero the count |
| Skip overshoots target | Creep band too narrow for the chosen creep speed | Log velocity at the entry of the creep band | Lower creep speed, increase creep_offset, or add a software ramp on the analog output |
| SF LED on the counter module | Diagnostic interrupt pending (wire break on encoder supply, or parameterization error) | Open module diagnostics in STEP 7 (Module Information → Diagnostics Buffer) | Re-seat the module, check for 24 V short, re-download HW Config |
| BF LED on the IM151 | Profibus address conflict or missing termination | Check Profibus address DIP switches and bus terminator on the last slave | Set unique address, enable termination |
SFB 44 (POS) is provided only in the integrated I/O of compact CPUs (CPU 312C, 313C, 314C). It cannot be used with an external ET 200S counter module on a 315-2DP / IM151 station. For positioning on this topology, the user program must implement its own position-control state machine, or the project can be migrated to Easy Motion Control, which provides library FBs for relative and absolute moves with the 1 Count 24V/100kHz.10. Alternative Hardware Considerations
If the project grows — higher encoder frequencies, 5 V encoder signals, more axes, or sub-millisecond gating — consider the following alternatives:
| Need | Recommended Module | Reason |
|---|---|---|
| Higher count frequency (5 V encoder, > 100 kHz) | FM 350-1 (6ES7 350-1AH03-0AE0) | Up to 500 kHz, supports 5 V (RS-422) |
| Multi-axis positioning with ramp profiles | Easy Motion Control V2.1 + FM 35x | Library provides camming, gearing, positioning FBs |
| Compact CPU with HSC built in | CPU 312C (6ES7 312-5BD01-0AB0) | Integrated 10 kHz HSC and SFB 44 for single-axis positioning |
| Distributed, Profinet-based architecture | ET 200SP TM Count 1x24V (6ES7 138-6AA00-0BA0) | Modern successor to the ET 200S 1 Count, Profinet integration |
For a single skip moving between 3–4 stations at < 100 rpm, the 1 Count 24V/100kHz on the existing ET 200S Profibus slave is the lowest-cost solution. For new designs, migrating to ET 200SP / Profinet is recommended.
11. Verification Checklist
- ☐ Module online in HW Config, no SF/BF LEDs lit
- ☐ Encoder count visible in VAT (e.g.
IW 100) and changes with manual rotation - ☐ Direction matches expected motion (positive rotation → positive count)
- ☐ Compare outputs DO 0 and DO 1 toggle at the programmed positions
- ☐ 4–20 mA analog output ramps between creep and fast values without overshoot
- ☐ VFD enable signal de-asserts at the stop position and dwell time is met
- ☐ Cycle time repeatable within ±2 counts across 10 consecutive moves
- ☐ Diagnostic interrupts cleared and diagnostic buffer empty after one full cycle
For the official Siemens manual and example code, see the Siemens example for ET 200S Counter, the 6ES7 138-4DA04-0AB0 product page, and the FM 350-1 product page. The Easy Motion Control software package is available on the Siemens support portal for projects that need more than a single-axis creep/stop profile.
Will the 1 Count 24V/100kHz (6ES7 138-4DA04-0AB0) work with my CPU 315-2DP and IM151 Standard?
Yes. The CPU 315-2DP (6ES7 315-2AG10-0AB0) is a Profibus DP master, and the IM151 Standard (6ES7 151-1AA03-0AB0) is a Profibus DP slave — they interoperate as standard master/slave. The 1 Count module is configured in HW Config and exposes its count value as 4 bytes of process input to the CPU. No special function blocks beyond the standard Siemens example are required.
My 360 PPR encoder rotates but the count stays at 0 in the VAT. What is wrong?
The most common causes are: the encoder supply is missing or reversed, the encoder is NPN-only and the 24 V input cannot sink current, the encoder is wired to the wrong channels, or the 1 Count module is sitting in a slot that is not powered. Verify 24 V at terminals 1 and 2 of the TM-E, confirm the encoder output type is push-pull or PNP, and check that a power module (PM-D or PM-E) is placed to the left of the counter module in the ET 200S row.
Can I use SFB 44 (POS) on a 315-2DP with an ET 200S counter module?
No. SFB 44 is part of the integrated I/O of compact CPUs (CPU 312C, 313C, 314C). It is not available on a 315-2DP and it does not operate on ET 200S counter modules. The position-control logic — fast, creep, stop, dwell — must be implemented in the user program on the 315-2DP, or you must use the Easy Motion Control library which provides FBs that work with the 1 Count module.
Do I need the FM 350-1 instead of the ET 200S 1 Count for this application?
For a 360 PPR encoder at 60 rpm the maximum pulse rate is 360 Hz per channel, or 1,440 counts per second with ×4 evaluation — well below the 100 kHz limit of the 1 Count module. The FM 350-1 is needed only if you upgrade to a 5 V (RS-422) encoder, exceed 100 kHz, or need more than one counter channel on the same module. For this skip-positioning application the ET 200S 1 Count is sufficient and cheaper.
How do I scale the 4–20 mA VFD reference from the S7 analog output?
The S7 analog output is 0..27648 raw, mapped to 0..20 mA (or 4..20 mA on a 2AO with the 4 mA offset enabled). Use I_out (mA) = 4 + (raw / 27648) × 16 for 4–20 mA. Always clamp the raw value with LIMIT (MN, IN, MX) in STEP 7 to prevent the VFD from receiving negative or excessive current, and configure the VFD's minimum frequency to a safe non-zero value to avoid the motor stalling in the creep band.