Encoder counts negative counterclockwise when it should count down

7 min read · Published November 10, 2026

A quadrature counter holds one signed value that started at zero, so counterclockwise travel runs it negative from the index. Have the PLC write the counter's reset value through a system command first, then trigger the reset, so the count starts at full circumference and runs down to zero.

Yes, the counter can start at full circumference and count down, and the hardware stays as it is. At the index, have the PLC write the CTRIO reset value through a system command, then trigger the reset: 0 for a clockwise run, the full-turn value for a counterclockwise one. On the 40.000 in cylinder that full-turn value is 20000 counts, or 40.000 if the module is scaled to inches. The display then starts at full circumference and runs down to zero instead of running negative from zero. The 35.000 in and 33.000 in cylinders need no change to a reset value entered in counts, because the encoder still delivers one full turn of counts per revolution; only the inches per count change. Where the reset has to stay at zero for other logic, two's-complement rungs in the PLC produce the same displayed number from the negative raw count.

Why the count runs negative in one direction

A quadrature counter holds one signed value and moves it both ways: pulses in one direction add to it, pulses in the other direction subtract from it. Which physical direction adds is set by which channel leads, the same phase rule that tracks boxes on a conveyor with an encoder uses. With the reset value at 0, clockwise travel from the index counts up to the full turn and the index reset starts it over. Counterclockwise travel subtracts from 0, and subtracting from zero is how a signed counter produces negative numbers. The negative reading is a direction result, not a damaged encoder. Match your symptom below before changing anything:

  • Negative counts from the index in one direction only. The reset value is 0 and that direction subtracts. Write that direction's reset value before the reset.
  • The display snaps from full circumference to 0 at the index. The index reset is active with a reset value of 0: wanted behavior clockwise, wrong starting point counterclockwise.
  • A small reverse motion shows a huge number. The raw negative count is being read as unsigned. A count of -1750 read unsigned in a 32-bit register is 4,294,967,296 - 1750 = 4,294,965,546. Branch on the high bit or apply the reset-value method.
  • One full turn reads the wrong distance. The counts-per-revolution basis behind the scale does not match the configuration: a 5000 PPR encoder delivers 20000 counts per revolution when the module counts all four quadrature edges, 5000 when it counts one edge per line.

Write the reset value, then trigger the reset

The reset always loads whatever reset value the module currently holds, so the value has to be in place before the reset fires:

  1. Bring the cylinder to the index.
  2. Select the direction of travel with its own pushbutton. Clockwise: the PLC writes 0 to the reset value through the CTRIO system command. Counterclockwise: it writes the full-turn value, 20000 counts, or 40.000 when the module is scaled to inches.
  3. After the write completes, trigger the reset with a second pushbutton. The module documentation defines the reset as a bit that, switched on, resets the counter value to the reset value.
  4. Permit motion only after the display shows the expected start value: 0 for clockwise, the full circumference for counterclockwise.

Two details keep this working in the field. The reset value typed into the module's configuration software serves hardwired resets; the value the PLC writes through the system command serves resets triggered from the ladder, so a hand-wired reset input and a PLC reset can hold different values. The command number and the register that carries the value come from the command list in your module's manual; the sequence is here, the command itself is in the manual. Keep the direction pushbutton and the reset pushbutton separate so one press cannot load the wrong endpoint. And keep the order fixed: if the reset fires first and the write lands after, the display sits at the old value until the next reset.

Example: 3.5 in counted down from full circumference

Scenario: the 40.000 in cylinder, a 5000 PPR encoder, the module counting quadrature, so one revolution is 5000 × 4 = 20000 counts.

Step Arithmetic Result
Counts per revolution at x4 5000 × 4 20000 counts
Inches per count 40.000 ÷ 20000 0.002000 in
Travel converted to counts 3.5 ÷ 0.002000 1750 counts
Display, reset-value fix 20000 - 1750 = 18250 counts 18250 × 0.002000 = 36.500 in
Display, two's-complement rungs magnitude 1750, then 20000 - 1750 = 18250 36.500 in

Both methods land on 36.500 in, which cross-checks as 40.000 - 3.5 in inches. The other cylinders share the same 20000 counts per revolution: 35.000 ÷ 20000 = 0.001750 in per count, and 33.000 ÷ 20000 = 0.001650 in per count. Counts per revolution never change with cylinder size, only the inches per count do, which is why one reset value in counts serves all three cylinders.

Two's-complement rungs when the reset stays at zero

Use this path when other logic reads the raw signed count and the reset value has to stay at 0 for both directions. The PLC branches on the count's high bit. High bit off: the count is positive, scale and display it as it stands. High bit on: the count is negative, form its magnitude, subtract the magnitude from the full-turn count, then scale. The rungs:

  • LDD V(count) loads the count
  • INV inverts every bit
  • ADDBD K1 adds 1, which completes the magnitude
  • OUTD V(negcountholdinglocation) stores the magnitude
  • LDD K5000 loads the full-turn count
  • SUBBD V(negcountholdinglocation) subtracts the magnitude from it
  • OUTD V(result) stores the display value

V(count), V(negcountholdinglocation) and V(result) are placeholders for your project's addresses. K5000 is the full-turn count of the configuration this example came from, one edge per line on a 5000 PPR encoder; the quadrature configuration in the example above subtracts K20000. On the example's 3.5 in of reverse travel the magnitude is 1750 and 20000 - 1750 = 18250 counts, the same 36.500 in the reset-value method shows. Scale only after the subtraction, and test both rotation directions plus the zero boundary before trusting the display.

Scaling the 35.000 in and 33.000 in cylinders

Keep the raw count in the module and convert it in the PLC with the circumference the operator selects on the panel:

position in inches = raw count from the index × selected circumference ÷ 20000

At 40.000 in, the example's 18250 counts read 18250 × 40.000 ÷ 20000 = 36.500 in; at 35.000 in the same counts read 18250 × 35.000 ÷ 20000 = 31.9375 in. Give the operator explicit choices, 40.000, 35.000 and 33.000, held in a PLC register the scaling rungs read. A panel entry does not rewrite the module's configured scale: the module keeps counting raw counts and the PLC does the cylinder-specific arithmetic.

The cost is one scan of age on the scaled copy. At one revolution per second the counter delivers 20000 counts per second, so a 5 ms scan leaves the scaled value 20000 × 0.005 = 100 counts behind, worth 100 × 0.002000 = 0.200 in on the 40.000 in cylinder. That lag is fine for a display and for most position interlocks. For a decision that must fire on an exact count, run it from the raw count. When the remaining distance also has to read from across the cell, large LED batch count displays take the same count, and shop-floor signage screens are built for the same environment.

Checks at the machine

  1. At the index, select clockwise, run the write-then-reset sequence and confirm the display reads 0.
  2. Turn one full revolution clockwise and confirm the count rises to 20000 counts, or 40.000 in scaled, and resets at the index.
  3. Return to the index, select counterclockwise, write the full-turn value, reset, and confirm the display reads the full circumference.
  4. Turn counterclockwise to half a revolution and confirm the display reads 10000 × 0.002000 = 20.000 in.
  5. Complete the turn and confirm the index reset brings the display back to the full-circumference start value.
  6. Fit the 35.000 in and 33.000 in cylinders and confirm one turn reads each circumference with the reset value still 20000 counts.
  7. With PLC scaling in use, compare the displayed position with the raw count at the index and at half a turn to confirm the 20000 basis matches.

Which method to use

Recommendation: write the reset value through the PLC and trigger the reset after the write completes, 0 for clockwise and 20000 counts, the 40.000 in cylinder's full turn scaled, for counterclockwise. It adds nothing to the counting path and the index reset keeps working in both directions. Keep the operator-selected scaling for the 35.000 in and 33.000 in cylinders in the PLC, with the raw count driving anything that fires on an exact count. Use the two's-complement rungs only when the raw signed count must stay untouched for other logic, and subtract the configured full-turn count, 20000 on this encoder counted at four edges per line.

Questions

Does the reset value go in as counts or as inches?

Enter it in the basis your configuration counts in. Rotate the cylinder one full revolution from the index and read the counter without scaling: a 5000 PPR encoder counted at four edges per line shows 20000, so 20000 is the reset value. If the module is scaled to inches and shows 40.000 at one turn, enter 40.000. Whatever number the display holds at one full turn, that number is the reset value.

Why does the example subtract from 5000 when the encoder is 5000 PPR?

The K5000 constant comes from a configuration that counts one edge per encoder line, 5000 counts per revolution. The same encoder counted at four edges per line delivers 20000 counts per revolution, so the constant becomes 20000 there. Subtract the configured full-turn count, never the label value, or the magnitude path lands short of one revolution and the display reads high near the index.

Which way does the count move right after a reset?

Module documentation states that after a reset the count defaults to the DOWN direction. The practical consequence: the value loaded by the reset is the value the display holds at the index, and travel away from the index moves the count in the direction the encoder's phase relationship sets. That is why the reset value, written before the reset, fully determines the starting reading.

Planning information, not legal or engineering advice. Rules differ by place: check codes and permits with your local authority and your licensed trades.

Keep reading

Build your signAsk for a quote