# Research on Data Transmission of Laser Sensors for Reading Ruler
## 3 Research on Coding Ruler Data
### Hybrid Coding  
In the field of digital encoding, traditional encoding methods such as binary encoding and Gray code encoding and innovations such as continuous shift encoding have limitations to some extent. Under the condition of limited bits, these coding modes can complete relatively few positioning coding tasks. A hybrid encoding method is proposed in order to overcome the limitations of these traditional encoding methods. The core idea of this encoding method is to generate a large number of different codewords by using random sequences. Under the condition of finite bits, the combination of random sequence encoding and displacement continuous encoding increases location encoding so as to meet wider application requirements [10]. Specifically, hybrid encoding combines the advantages of two different encoding modes, absolute and incremental encoding, to achieve higher accuracy and stability, and its working principle is that the position and speed are accurately monitored and fed back through the combined operation of the two encoding modes. As shown in Table 5, two coding modes are combined, one for absolute position and the other for relative position. \begin{table}
\begin{tabular}{c c c c c c c c c c c c c c} \hline \hline
0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 0 & 1 & 0 & 1 & 1 & 1 & 1 \\ \hline \multicolumn{1}{c}{0000 (0)} & \multicolumn{6}{c}{1001 (4)} & \multicolumn{6}{c}{1010 (8)} & \multicolumn{6}{c}{1111 (12)} \\ \hline \multicolumn{1}{c}{0001 (1)} & \multicolumn{6}{c}{0011 (5)} & \multicolumn{6}{c}{0101 (9)} \\ \hline \multicolumn{1}{c}{0010 (2)} & \multicolumn{6}{c}{0110 (6)} & \multicolumn{6}{c}{1011 (10)} \\ \hline \multicolumn{1}{c}{0100 (3)} & \multicolumn{6}{c}{1101 (7)} & \multicolumn{6}{c}{0111 (11)} \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Continuous Coding of Displacement. In practical engineering applications, due to significant vibrations in the working environment, the positioning accuracy of hybrid coding is \(\pm\)2 mm, and the scale installation track is 300 m. The positioning accuracy of binary coding is \(\pm\)3 mm. This encoding method based on a random sequence has many advantages in practical application. First, it can make full use of limited bit resources to generate more location codes, thus improving coding efficiency and flexibility. Secondly, due to the random sequence, the generated codeword has a better anti-jamming capability and can effectively resist the impact of noise and interference on the coding performance. This method also has better security because the generation and conversion process of the random sequence can be designed to be very complex and difficult to predict. Determining sequences are sequences that can be predetermined and repeatable. A pseudo-random sequence is a sequence that cannot be determined in advance, but its generation process can be repeated; sequences that are neither predetermined nor repeatable are called random sequences. An m sequence, also known as a maximum periodic feedback shift register sequence, is a pseudo-random binary sequence widely used in various fields [12]. It can be applied to spread spectrum communication to improve anti-jamming capability and the confidentiality of communication and achieve efficient spectrum utilization and signal separation in CDMA technology in satellite communication. In addition, in terms of digital data processing, an m sequence can be used for encryption and scrambling to ensure data security, synchronization, and bit error rate measurement to improve the accuracy and reliability of data transmission. These applications fully demonstrate the superior performance and wide application prospects of m sequences in the communication field. An n-level feedback shift register on GF (2) consists of n binary memories and a feedback function f (a\({}_{1}\), a\({}_{2}\),..., a\({}_{n}\)), as shown in Figure 2. There is a total of n registers (a\({}_{1}\), a\({}_{2}\),..., a\({}_{n}\)). Each register is a 0/1 binary storage unit, called the stage of feedback shift register.