Introduction to encoder principles
How Fourfold Decoding Works: Why One Line Yields Four Counts

A 1000-line encoder may show 4000 counts per revolution in the drive. The extra 3000 counts are not extra lines on the disc: they come from counting both the rising and falling edges of channels A and B. This article explains the difference between fourfold, twofold and single decoding, and the duty-cycle and phase requirements of fourfold decoding.
A servo motor is fitted with a 1000-line encoder, yet the feedback count per revolution in the drive parameters is 4000. Newcomers often ask: the disc clearly has only 1000 lines, so where do the other 3000 counts come from?
The answer is not extra lines on the disc, but the edges of the signals.

One period hides 4 edges
Each time the disc turns through one line, channel A outputs one full square-wave period, and so does channel B, only ¼ period later than A. Overlay the two channels and you see 4 edges in sequence within one period: rising A, rising B, falling A, falling B; see Figure 1.
Because B lags A by exactly ¼ period, these 4 edges divide one period into 4 equal parts. Count one at each edge and one line yields 4 counts: that is fourfold (quadrature) decoding.
| Line count | Counts per revolution after fourfold decoding | Angle per count |
|---|---|---|
| 1000 | 4000 | 0.09° (324″) |
| 2500 | 10 000 | 129.6″ |
| 5000 | 20 000 | 64.8″ |
Single, twofold and fourfold decoding
The receiving end can choose which edges to count. For a 1000-line disc, for example:
| Method | Edges counted | Counts per revolution | Per count |
|---|---|---|---|
| Single decoding | Rising edge of A only | 1000 | 0.36° |
| Twofold decoding | Rising and falling edges of A | 2000 | 0.18° |
| Fourfold decoding | All edges of A and B | 4000 | 0.09° |
Whichever method is used, channel B cannot be omitted, because direction is determined by which of A and B leads. Single and twofold decoding simply use fewer edges, so resolution is lower and the receiving end can count more slowly. Servo drives and motion-control cards usually use fourfold decoding; some general-purpose counter modules let you select the decoding factor in the parameters. When wiring and commissioning, check this together with the encoder line count, or the position will be out by a factor of 2 or 4.
The premise of fourfold decoding: 50% duty cycle and 90° phase
Fourfold decoding is “even” because the 4 edges are equally spaced. That requires two conditions: the high and low levels of A and B each occupy half of the period (50% duty cycle), and the phase difference between A and B is exactly 90°.
If the phase difference is only 60°, the intervals between the 4 edges become 60°, 120°, 60° and 120° electrical. On a 1000-line disc, the counts then alternately represent 0.06° and 0.12°; see Figure 2. The total per revolution is still 4000, but the angle each count represents is now alternately large and small, so the position reading shows a periodic jump and the speed calculation shows ripple.

A duty-cycle error has the same kind of effect. If the duty cycle of A becomes 40%, the falling edge of A comes early, at 144° electrical, and the 4 intervals become 90°, 54°, 126° and 90°, corresponding to 0.09°, 0.054°, 0.126° and 0.09°.
What determines duty cycle and phase
The square wave is obtained by putting the sine signal through a comparator. The duty cycle depends on whether the mid-level of the sine sits exactly on the comparison threshold, and the shape of the sine depends in turn on the lines on the disc: whether the line width is close to half the pitch, whether the width is consistent around the disc, whether the edges are clean, and whether the blocking is complete. The phase depends on how the scanning window matches the disc pitch; eccentricity of the disc makes it vary with angle.
So fourfold decoding is “free” resolution, but it is not free accuracy. The more uniform the lines, the more uniform the 4 counts. When still finer resolution is needed, the signals can be left unsquared and output as sine and cosine for interpolation — that is a subject for another article.
In brief
When A and B are 90° apart, one period contains 4 equally spaced edges; count them all and one line becomes 4 counts — that is fourfold decoding. Twofold and single decoding simply count fewer of those edges. Fourfold decoding requires a 50% duty cycle and 90° phase; if these are off, the total count is unchanged, but the angle each count represents is no longer uniform.
Translated from the ENC7 Chinese technical library (article 0005). Read the Chinese original. Need a disc built to your drawing? Request a quote or see our custom encoder discs.
© Langfang Jingzheng Optoelectronic Technology Co., Ltd. All rights reserved. This article was created with AI assistance.