Application of Gray Code Rotary Encoder in Displacement Detection

Abstract features Gray code rotary encoder, a binary converted by the PLC calculation formula, and a method of application of the displacement detection.
Keywords: rotary encoder displacement detection logic circuit

1 Introduction

In the follow-up position control system and displacement detection, the system must control the amount of wire displacement or angular displacement. More detection devices are needed, such as autosynthesizers, resolvers, and inductive synchronizers. For the measurement of the angular displacement of a rotating object, the use of a rotary encoder is essential. The rotary encoder converts the angular displacement directly into a digital signal. It is divided into two types: incremental and absolute. According to the different manufacturing processes, absolute encoders are divided into binary, two - decimal and Gray code disk. Let us introduce the features of the Gray code disc rotary encoder.

2 Features

The Gray code disc is characterized by only one code change between two adjacent sectors. When reading, even if there is a change, there can only be one photocell on the interface, it is only the error of the lowest one, and it is impossible to produce large errors, so the accuracy of such encoders is higher. Its disadvantage is that it cannot directly implement binary operations. It must be converted into binary code by logic circuit before operation. The resolution of the rotary encoder is 360/N, and the absolute encoder N = 2n, where n is the number of bits in the output word. The position of the axis and the corresponding digits are now calculated by combining the commonly used 16-digits. See the table below.

table

Position of the axis 0 1 2 3 ... 65535 binary code 0000
0000
0000
0000 0000
0000
0000
0001 0000
0000
0000
0010 0000
0000
0000
0011 ...... 1111
1111
1111
1111 Gray code 0000
0000
0000
0000 0000
0000
0000
0001 0000
0000
0000
0011 0000
0000
0000
0010 ...... 1000
0000
0000
0010


3 methods

3.1 Logic Circuits <br> Through the Gray code and binary code comparison parameter table, it is not difficult to find the law that Gray code is converted into binary code. The nth bit of the gray code is the same as the nth bit of the binary code. Bits n-1, ..., and 0 of the binary code can be logically ANDed by Gray2n-1 (Gray code n-1 bit) (binary nth bit) Bin2n-1 (binary n-1 bit) is derived. Therefore, the logic circuit is shown in Figure 1.

q

Figure 1 Logic Circuit

3.2 PLC input point conversion <br> In practical applications, such as the press slider adjustment, air cushion adjustment detection, use absolute rotary encoder, not only the mechanical installation is simple, and the detection of high displacement accuracy. In electrical control, if the logic circuit is designed, then the cost is high and it is not economical. Through the PLC module input points and internal relays, the conversion from Gray code to binary code can be realized completely. In the PLC, it is converted into the actual adjustment value by the operation instruction. Therefore, data communication, data display, etc. can be realized through the PLC. In the following, the IVN module of AB company PLC5 is the input point of Gray code. This module is set as the 0 frame, the first module of the first group. The process of converting Gray code to binary code can be invoked as a subroutine. When the PLC main program computes the adjustment amount, it can directly call this subroutine, so that the entire program is much simpler to handle. The program is shown in Figure 2. Internal relays B4/960 to B4/975, B4/976 to B4/991 are converted to binary files B4:60 and B4:61. According to the binary number corresponding to B4:61, the arithmetic value can be converted into actual value according to the specified ratio.

2

Figure 2 Gray code conversion procedure to binary code

4 Conclusion

The encoder is simple and practical. In places where the degree of automation is relatively high, such as manipulators and robot servo control systems, the use of this encoder is indispensable for automatically returning the origin and memorizing the parking position.

Child Costumes

Child Costumes,Girls Cosutmes,Party Costumes Carnival,Carnival Halloween Costumes

Leadtex Animation Creative Co., Ltd. , https://www.leadtex.com