The difference between encoder and decoder
The difference between encoder and decoder
Most people know encoders and decoders, but sometimes they confuse these two concepts. Next, the editor of okplazas.com will explain to you the difference between encoder and decoder.
An encoder is a device that compiles and converts a signal (such as a bit stream) or data into a signal form that can be used for communication, transmission and storage. The encoder converts angular displacement or linear displacement into electrical signals. The former is called a code wheel and the latter is called a code ruler. Encoders can be divided into contact type and non-contact type according to the read-out mode; according to the working principle, encoders can be divided into two types: incremental and absolute. The incremental encoder converts the displacement into a periodic electric signal, and then converts this electric signal into a counting pulse, and the number of pulses is used to indicate the magnitude of the displacement. Each position of the absolute encoder corresponds to a certain digital code, so its indication is only related to the start and end positions of the measurement, and has nothing to do with the middle process of the measurement.
According to the different classification of the code disc
(1) Incremental type: It is to send out a pulse signal every time the angle of the unit is rotated (also send a sine and cosine signal, then subdivide it, and chop it to produce a higher frequency pulse), usually A phase, B phase , Z phase output, A phase and B phase are mutually delayed by 1/4 cycle pulse output. According to the delay relationship, the forward and reverse can be distinguished, and the frequency can be doubled or 4 times by taking the rising and falling edges of A and B ; Phase Z is a single-turn pulse, that is, one pulse is sent out every turn.
(2) Absolute value type: It corresponds to a circle, and each reference angle emits a unique binary value corresponding to the angle, and multiple positions can be recorded and measured by an external circle device.
According to the type of signal output, it is divided into: voltage output, open collector output, push-pull complementary output and long-line drive output.
Classified by encoder mechanical installation form
(1) Shaft type: Shaft type can be divided into clamping flange type, synchronous flange type and servo mounting type.
(2) Sleeve type: The sleeve type can be divided into semi-empty type, full-empty type and large-diameter type.
According to the working principle of the encoder, it can be divided into: photoelectric type, magnetoelectric type and contact brush type.
A photoelectric code disc with an axis in the center, on which there are circular and dark engraved lines, is read by photoelectric transmitter and receiver, and obtains four sets of sine wave signals combined into A, B, C, D, each sine wave Phase difference of 90 degrees (relative to a cycle of 360 degrees), the C and D signals are reversed and superimposed on the A and B phases to enhance the stable signal; in addition, a Z-phase pulse is output every revolution to represent the zero reference Bit.
Since the phases A and B differ by 90 degrees, the encoder's forward and reverse rotation can be judged by comparing the phase A or the B phase. The zero reference position of the encoder can be obtained through the zero pulse. The materials of the encoder code disc are glass, metal, plastic. The glass code disc is deposited on the glass with very thin scribe lines, which has good thermal stability and high precision. The metal code disc is directly engraved with through and impassable lines and is not fragile. However, due to the certain thickness of metal, the accuracy is limited, and its thermal stability is one order of magnitude worse than that of glass. Plastic code discs are economical, and their cost is low, but accuracy, thermal stability, and life are worse. .
Resolution-The number of open or dark engraved lines provided by the encoder per 360 degree rotation is called resolution, also known as resolution division, or directly called the number of lines, generally 5 to 10,000 lines per revolution.
Mechanical installation dimensions: including positioning stop, shaft diameter, installation hole position; cable outlet method; installation space volume; whether the working environment protection level meets the requirements.
Resolution: That is, the number of pulses output per revolution when the encoder is working, whether it meets the design and use accuracy requirements.
Electrical interface: Common encoder output methods include push-pull output (F type HTL format), voltage output (E), open collector (C, common C is NPN tube output, C2 is PNP tube output), and long-line driver output. Its output mode should match the interface circuit of its control system.
Decoder is a kind of multiple-input multiple-output combinational logic circuit device, which can be divided into two types: variable decoding and display decoding. The variable decoder is generally a device that converts less input into more output. The common ones are n-line-2^n-line decoding and 8421BCD code decoding; display decoders are used to convert binary numbers into corresponding The seven-segment code can generally be divided into two types: driving LED and driving LCD.
Decoding is the reverse process of encoding. During encoding, each binary code is given a specific meaning, that is, it represents a certain signal or object. The process of "translating" the specific meaning of the code state is called decoding, and the circuit that implements the decoding operation is called a decoder. In other words, the decoder is a circuit that can translate the state of the input binary code into an output signal to express its original meaning.
There are many types of decoders, but their working principles and analysis and design methods are similar. Among them, binary decoders, two-decimal decoders and display decoders are the three most typical and widely used decoding circuits.
Binary code decoder, also known as minimum item decoder, takes one decoder from N, the minimum item decoder generally translates binary code into decimal code;
Transcoding decoder is to convert from one encoding to another;
The display decoder generally translates a code into a decimal code or a specific code, and displays the status of the decoder through a display device.
The decoder is a logic circuit with a "translation" function. This circuit can translate the various states of the input binary code into corresponding output signals according to its original intent. Some decoders are equipped with one or more enable control input terminals, which become chip select terminals to control whether to allow or prohibit decoding. The process of encoding and decoding is just the opposite. The encoder can generate a set of binary codes for a valid input signal. Some encoders are equipped with an enable terminal to control whether encoding is allowed or prohibited.
The function of the priority encoder is to allow input signals at several input terminals at the same time. The encoder will only encode the one with the highest priority among several signals input at the same time according to the priority order of the input signals. In Figure 6, 74147 is a BCD priority encoder, input and output are both active low. In order to obtain an effective output high level, an inverter can be connected to each output terminal. 7417 has only 1-9 each input terminal, 0 input terminal is not connected to the circuit. This is because 7417 stipulates that when there is no valid input, the BCD code 0000 of 0 is output.
The variable decoder is a combinational logic circuit with multiple outputs that transforms n inputs into 2^n outputs. The model can be represented by the following figure. Among all the combinations of input changes, each output is 1 only once. Since the smallest item is 1 only once in the truth table, the output is the smallest item of the input variable. combination. So the decoder can also be called the minimum term generator circuit.