Share this

Understanding the working principle of encoders and programming high-speed counters in one article

2026-04-06 06:07:53 · · #1

An encoder is a rotary sensor that converts rotary displacement into a series of digital pulse signals. These pulses can be used to control angular displacement. If the encoder is combined with a rack and pinion or a lead screw, it can also be used to measure linear displacement.

After the encoder generates an electrical signal, it is processed by numerical control (CNC), programmable logic controller (PLC), control system, etc. These sensors are mainly used in the following areas: machine tools, material processing, motor feedback systems, and measurement and control equipment. In the ELTRA encoder, angular displacement conversion uses the photoelectric scanning principle. The reading system is based on the rotation of a radial indexing disk, which consists of alternating transparent and opaque windows. This system is entirely illuminated perpendicularly by an infrared light source, so that the light projects the image on the disk onto the surface of a receiver covered with a grating called a collimator, which has the same window as the optical disc. The receiver's function is to sense the light changes caused by the rotation of the optical disc and then convert these light changes into corresponding electrical changes. Generally, rotary encoders also generate a speed signal, which is fed back to the frequency converter to adjust the converter's output data.

Encoders are generally divided into incremental and absolute types, with the biggest difference being that in the case of an incremental encoder, the position is determined by the number of pulses counted from the zero mark, while the position of an absolute encoder is determined by the reading of the output code. In one revolution, the output code reading for each position is unique; therefore, when the power is disconnected, an absolute encoder does not become disconnected from the actual position. If the power is restored, the position reading remains current and valid; unlike an incremental encoder, it does not require searching for the zero mark.

Nowadays, encoder manufacturers produce a wide range of series, which are generally specialized, such as encoders for elevators, encoders for machine tools, and encoders for servo motors. Moreover, these encoders are intelligent and have various parallel interfaces that can communicate with other devices.

An encoder is a device that converts angular or linear displacement into electrical signals. The former is called a code disk, and the latter a code scale. According to the reading method, encoders can be divided into two types: contact and non-contact. Contact encoders use brushes for output, with one brush contacting a conductive or insulating area to indicate whether the code state is "1" or "0". Non-contact encoders use photosensitive or magnetic sensitive elements to receive signals. When using photosensitive elements, the light-transmitting and opaque areas are used to indicate whether the code state is "1" or "0".

Encoders can be classified into two categories based on their working principle: incremental and absolute. Incremental encoders convert displacement into periodic electrical signals, then convert these signals into counting pulses, using the number of pulses to represent the magnitude of the displacement. Absolute encoders, on the other hand, assign a unique digital code to each position; therefore, their reading depends only on the starting and ending positions of the measurement, and is independent of the intermediate steps.

Rotary incremental encoders output pulses as they rotate, and their position is determined by a counting device. When the encoder is stationary or there is a power outage, the position is remembered by the internal memory of the counting device. Therefore, the encoder cannot move at all after a power outage, and when power is restored, there must be no interference during the encoder's pulse output process to avoid pulse loss; otherwise, the zero point remembered by the counting device will shift, and the amount of this shift is unknown until an erroneous production result occurs. The solution is to add a reference point. Every time the encoder passes the reference point, it corrects the reference position into the memory position of the counting device. Before the reference point, the position accuracy cannot be guaranteed. Therefore, in industrial control, methods such as finding the reference point before each operation and zeroing upon power-on are used. Such encoders are determined by the mechanical position of the code disk and are unaffected by power outages or interference.

An absolute encoder ensures the uniqueness of each position determined by its mechanical position. It requires no memory, no reference points, and doesn't need to constantly count; it only reads the position when needed. This significantly improves the encoder's anti-interference capabilities and data reliability.

Because absolute encoders are significantly superior to incremental encoders in positioning, they are increasingly used in industrial control positioning. Due to their high precision and large number of output bits, absolute encoders require parallel outputs. Each output signal must be securely connected, and isolation is necessary for complex operating conditions. The large number of connecting cable cores leads to numerous inconveniences and reduced reliability. Therefore, absolute encoders with multi-bit outputs generally use serial or bus-type outputs. The most common serial output for absolute encoders manufactured in Germany is SSI (Synchronous Serial Output).

Multi-turn absolute encoders. Encoder manufacturers utilize the principle of clockwork gears. When the central code disk rotates, it drives another set of code disks (or multiple sets of gears and code disks) through gears, adding more turns of encoding on top of the single-turn encoding to expand the encoder's measurement range. This type of absolute encoder is called a multi-turn absolute encoder. It also uses mechanical position to determine the encoding, with each position having a unique and non-repeating code, eliminating the need for memorization. Another advantage of multi-turn encoders is their large measurement range, often providing ample margin for error in practical applications. This simplifies installation and debugging by eliminating the need for painstaking zero-point finding; a middle position can be used as the starting point. Multi-turn absolute encoders have significant advantages in length positioning and are increasingly used in industrial control positioning.

High-speed counter

describe:

A high-speed counter is a counter capable of calculating pulse signals with a faster scanning frequency than a standard counter. Its working principle is similar to a regular counter, but the response time of the counting channel is much shorter. In an increasing number of control processes, there is a need to process high-speed pulse signals, and ordinary counting methods are far from sufficient. Therefore, high-speed counters are required.

Counters are one of the important soft components inside a PLC. High-speed counters are a commonly used type of PLC counter. There are two types of counters inside a PLC: one is a counter that counts internal signals of the PLC, and the other is a counter that counts external event signals.

Types of high-speed counters and their component numbers

1. Types of high-speed counting

The basic unit has a built-in 32-bit up/down high-speed counter (single-phase counter/single-phase dual counter/dual-phase dual counter). Depending on the counting method, it can be divided into hardware counters and software counters.

The high-speed counter provides the option to select an external reset input terminal and an external start input terminal to begin counting.

2. Differentiation of high-speed counters

Hardware counter: This type of counter counts using hardware.

Software counters: These counters are used to count via CPU interrupt handling, and each counter needs to be used under two constraints: maximum response frequency and composite frequency.

3. Types of high-speed counters and the form of input signals

4. Overview of high-speed counter software components

Two high-speed counter input allocation

The allocation table for each high-speed counter, X000-X007, is as follows:

Three-speed counters are used

1. Input of single-phase single counter

2. Input of single-phase dual counter

3. Input of two-phase dual counter

Disclaimer: This article is a reprint. If it involves copyright issues, please contact us promptly for deletion (QQ: 2737591964 ) . We apologize for any inconvenience.

Read next

CATDOLL Laura Soft Silicone Head

You can choose the skin tone, eye color, and wig, or upgrade to implanted hair. Soft silicone heads come with a functio...

Articles 2026-02-22