AutomateDirectUSAMotion LibraryIndustrial monitors & PCs

Troubleshooting

HSC configured but not counting on an S7-1200 encoder input

Sensors, encoders and machine vision on the machine Published 9 min read By AutomateDirectUSA engineering team

Short answer

Blinking input addresses prove the encoder signal reaches the terminals, not that the counter accumulates. Work the branches in order: match the encoder output family to the input, wire to the HSC-capable terminals the configuration names, download the hardware configuration, keep the input filter below a quarter of the shortest pulse at full speed, and run the counter control with its software gate enabled.

On this page
  1. Why do the input addresses blink while the counter stays at zero?
  2. Does the encoder output family match what the inputs are specified to read?
  3. Are the channels on terminals the HSC actually counts?
  4. What input filter time passes encoder pulses without swallowing them?
  5. Is the counter enabled in the hardware configuration and downloaded?
  6. Is the software gate enabled in the program?
  7. What order should the checks run in?
  8. Questions asked

An S7-1200 high-speed counter that stays at zero while its input addresses blink is not a wiring failure you can see on the LEDs: blinking proves the transitions reach the input image, nothing more. The counter accumulates only when all of these hold at once — the signal levels match what the inputs are specified to read, the channels sit on the HSC-capable terminals the device configuration names, the hardware configuration has been downloaded to the CPU, and the counter's software gate is enabled in logic that runs every scan. In the working setup on a CPU 1214C DC/DC/DC, hsc_1 was enabled in A/B mode on I0.0 and I0.1 with a 0.1 ms input filter, and that combination counted. Work the branches in the order below.

Blinking tells you the pulses are crossing the input filter into the process image; it says nothing about whether the counter points at those terminals, whether its hardware configuration is downloaded, or whether its software gate is open — the three branches that produce exactly this symptom.

Put the counter's current value into a watch table and turn the shaft slowly by hand. If the value never moves while both addresses animate, the fault is downstream of arrival, in one of the branches below — not in the encoder's ability to make pulses.

The process image also shows each channel alone, and an A/B counter judges the pair: it needs a repeatable staggered sequence, one order for up and the reverse order for down. Watch both addresses together and confirm the sequence reverses when you reverse the shaft; speed and direction from an incremental encoder into a counter input is the mechanism behind that check.

Decision: blinking closes only the arrival branch. Keep the counter value on screen and work down the remaining branches.

Does the encoder output family match what the inputs are specified to read? #

Match the electrical interface before touching any configuration: an encoder with complementary differential outputs delivers each channel as an active driver pair, and a standard 24 V DC input expects one signal referenced to its own common, so the connection must follow the datasheet's documented single-ended arrangement.

Encoders ship with single-ended outputs or with complementary differential pairs, one driver pair for each channel. A 5 V-class differential pair will not drive a 24 V DC input directly — connecting a 5 V encoder to 24 V PLC inputs walks that mismatch. The setup in question used an encoder with differential outputs, a reported fact to verify against the datasheet, and the connection that finally counted was a four-conductor single-ended arrangement:

  • green to I0.0
  • grey to I0.1
  • brown to +24 VDC
  • white to 0 VDC

Colors are not a pinout. Under the DC color convention brown marks the positive conductor and blue the 0 V return, yet this encoder used grey and white for channel and return — the convention is laid out in guide to CE-compliant DC wire colors for brown, blue and grey conductors, and the conductor functions still come from the encoder datasheet's connection diagram. If you use only the positive leg of each differential pair, handle the negative legs the way that diagram documents, never clamped to common or to a made-up midpoint on a guess.

Isolate the 24 V circuit before moving conductors and confirm polarity before reapplying power. Decision: when the datasheet documents the single-ended arrangement and the measured high and low levels sit inside the window the input specification defines, this branch is closed; no filter or gate change makes an unreadable signal count.

Are the channels on terminals the HSC actually counts? #

Only some input terminals are HSC-capable on any given CPU, and the counter accumulates on the pair the device configuration names — in this setup, hsc_1 in A/B mode on I0.0 and I0.1 on a CPU 1214C DC/DC/DC — so an ordinary input that animates proves the wire, not the counter.

Not every input on an S7-1200 carries the high-speed counter function; the capable terminals for your exact CPU come from the system manual's terminal diagrams, and a blinking ordinary input next to a configured counter proves nothing about the pairing. In TIA Portal, open the CPU's device configuration, confirm the counter is enabled, that its counting mode is A/B, and that the assigned inputs are the same physical terminals the conductors land on.

Phase order belongs to this branch too. With A leading B the count runs up; with B leading A it runs down, so a swapped pair shows up as a counter running the wrong way — not as a counter frozen at zero.

Decision: if the wired terminals and the configured terminals differ by even one point, move the conductors or re-assign the counter, then close the download branch below before judging the result.

What input filter time passes encoder pulses without swallowing them? #

The filter time must sit well below the encoder's shortest high or low time at full speed: for a 1000 P/R channel at 1500 rpm that time is 20 µs, so a 0.1 ms filter passes a hand-turn test and silently rejects every pulse at speed.

The digital input filter ignores transitions shorter than roughly its own time, which is exactly what makes it useful against noise and dangerous to encoder pulses — the same mechanism behind why a PLC input filter drops encoder pulses. The setup in question started with an input time of 0.4 µs and the working report used a 0.1 ms filter — a factor of 250, so read the unit on that setting before copying anyone's number.

Worked example, calculated for these inputs and not measured: a 1000 P/R channel at a maximum of 1500 rpm.

  • 1500 rpm ÷ 60 = 25 rev/s
  • channel frequency: 1000 pulses/rev × 25 rev/s = 25,000 Hz
  • period: 1 ÷ 25,000 s = 40 µs, so at 50 percent duty the high and low times are 20 µs each
  • the 0.1 ms (100 µs) filter rejects pulses far shorter than its own time — every pulse at this speed is swallowed, and the counter freezes at speed while still counting a slow hand turn (at 60 rpm the half-period is 500 µs and passes)

Decision for this example: keep the filter at or below a quarter of the shortest pulse — 20 µs ÷ 4 = 5 µs — which means one of the microsecond-class settings in the CPU's documented filter list, proven at operating speed rather than by hand. The report's filter value survives only where the channel's shortest pulse is about 400 µs or longer; at 1000 P/R that is roughly 60 rpm or less. And because the wiring was reworked at the same time in that report, the filter was never isolated as the fix.

Is the counter enabled in the hardware configuration and downloaded? #

Enabling the counter in the project does nothing until the hardware configuration is downloaded: the Siemens documentation for the counter control instruction names a counter not enabled in the CPU hardware configuration as a cause of this no-counting behavior, and a program-only download leaves the old configuration active.

After enabling the HSC inputs or changing anything about the counter — mode, terminals, filter — download the hardware configuration, not just the program blocks, and make that a habit after every configuration edit. The S7-1200 system manual's counting chapter documents the hardware configuration as part of the counter's path; treat an un-downloaded change as untested.

If the application is deep and you suspect interference, build a clean project with only the device configuration and the gate logic. If the counter runs there, the configuration is sound and the difference lives in the application; port it back deliberately instead of editing the live project blind.

Decision: any counter you have touched without a hardware download afterwards has not been tested yet — download first, then retest by hand.

Is the software gate enabled in the program? #

A configured counter still accumulates nothing until its control logic runs with the software gate on: the CTRL_HSC instruction or the code behind a counter technology object must execute every scan with the gate input held TRUE, or the count value stays frozen.

The hardware side counts internally even when the program ignores it; what reaches your logic is gated. Find the counter's control — the CTRL_HSC (Control high-speed counter) instruction or the code behind its technology object — and confirm two things: the call executes unconditionally every scan, and the software gate input is held TRUE while counting should run. A call parked behind a jump, a case branch or a one-shot never opens the gate, and the value you watch stays frozen.

Force the gate TRUE as a test, rotate the shaft, and watch the current value: if it moves with the gate forced and freezes again when you restore the application logic, the branch is your program's gating condition, not the counter.

Decision: run the counter control every scan and hold the gate TRUE for the whole counting window — a counter configured but never enabled in logic counts nothing, forever.

What order should the checks run in? #

Run the branches cheapest first and stop at the first one that fails: in bench experience the gate and the missing hardware download are the two branches most often left open, and only the remainder turn out to be an interface or terminal problem.

Work the list top to bottom:

  1. Put the counter's current value in a watch table and turn the shaft by hand — this separates an accumulation problem from an arrival problem.
  2. Watch both input addresses together and confirm the staggered sequence reverses with direction.
  3. Compare the encoder's output family and each conductor's function against the datasheet's documented connection, and measure the levels at the terminals.
  4. Confirm the configured counter points at the same HSC-capable terminals in A/B mode.
  5. Download the hardware configuration after any counter or input change.
  6. Compute the pulse width from counts per revolution and maximum speed, and set the filter below a quarter of it.
  7. Run the counter control every scan with the software gate TRUE, then retest by hand and again at operating speed.
  8. If every branch closes and the value still sits at zero, rebuild in a clean project with only the counter configuration and gate logic; if it still refuses there, take the CPU, its firmware version and the configuration to the PLC vendor's support channel.

Closed in that order, whichever branch was left open is the fix — in the setup described here, it took the datasheet-correct interface plus the filter set against the pulse width before hsc_1 counted.

Questions asked

Where does the high-speed counter value appear if not at the input addresses?

The input addresses only mirror raw input states. The accumulated count is delivered through the counter in the program, as the current-count value offered by the counter's control instruction or its technology object, so that value is what belongs in your watch table. An input address tells you LED-level state, never the count.

Counts run but the direction is backwards — what moved?

Nothing electrical. In A/B counting the phase order sets direction: when channel A leads channel B the count runs up, and when B leads A it runs down. Swap the two channel conductors at the terminals, or exchange the channel assignment in the counter's device configuration and download the hardware configuration again, so the phase order matches your direction convention.

Can the complementary legs of a differential encoder be tied to common?

Not on a guess. On many differential drivers the negative legs are actively driven outputs, and clamping one to common or to a made-up midpoint makes the driver fight the clamp, which distorts the edges or overloads the output stage. Use the single-ended connection the datasheet documents, a signal converter, or an encoder whose output family matches the input.

The counter works by hand but freezes at machine speed — which branch is that?

The filter branch. Pulse width scales inversely with speed: double the rpm and the high and low times halve, so a filter that passes slow rotation rejects every pulse once the width drops below the filter time. Recompute the width at maximum speed, shorten the filter to a quarter of it or less, and retest at speed.

Keep reading

  • How-to

    Counting Encoder Pulses on a PLC Without Losing Position

    Count encoder pulses with a hardware high-speed counter input wired for quadrature, never with a count instruction in the scan. At 214 rpm and 75 pulses per revolution the encoder delivers 267.5 pulses per second, one every 3.7 ms, while a 10 ms scan cannot guarantee seeing even one in three. Zero the counter at a reference switch and treat every target as counts from that switch.

    Sensors, encoders and machine vision on the machine

  • Troubleshooting

    Why the PLC input filter drops encoder pulses

    A hand-turned 1024 PPR encoder that shows 10 to 30 counts per revolution on a high-speed counter is almost always being rejected by the digital input filter, which suppresses any state shorter than its configured time. Check the signal at the terminal, set the filter below the shortest pulse width, then verify the HSC assignment and count address, in that order.

    Sensors, encoders and machine vision on the machine

  • Explainer

    Why an analog input module cannot count encoder pulses

    Encoder channels produce edges; an analog input module samples voltage and returns one value per channel per scan, so any pulse between two samples is lost and position cannot be recovered. Put the encoder on a high-speed counter input rated above (RPM ÷ 60) × pulses per revolution in hertz, matched to the encoder's voltage class. On an S7-300, the documented route is the FM 350-1 or FM 350-2 counter module, or a compact CPU with integrated counting inputs.

    Sensors, encoders and machine vision on the machine