Whether digital or analog, data must be converted into signals for the purpose of transmission. The process of converting data into analog signals is called modulation, and the process of converting data into digital signals is called encoding. Signals are the specific representation of data. They have a certain relationship with data, but are different from data. Digital data can be converted into digital signals by a digital transmitter for transmission, or converted into analog signals by an amplifier modulator for transmission; similarly, analog data can be converted into digital signals by a PCM encoder for transmission, or converted into analog signals by an amplifier modulator for transmission. This forms the following four encoding methods. 1. Digital data encoding into digital signals Digital data encoding is used in baseband transmission, that is, digital signals are directly transmitted without substantially changing the frequency of the digital data signal. For this encoding method, what kind of digital signal is used to represent 0 and what kind of digital signal is used to represent 1 is called encoding. There can be many encoding rules. In principle, as long as they can effectively distinguish 1 from 0, the commonly used encoding methods are as follows: (1) Non-return-to-zero code Non-return-to-zero code (NRG) uses two voltages to represent two binary digits, such as using a low level to represent 0 and a high level to represent 1, or vice versa. Although this encoding is easy to implement, it has no error detection function and cannot determine the beginning and end of a code element, so that the transmitter and receiver are difficult to maintain synchronization. (2) Manchester encoding Manchester encoding divides a code element into two equal intervals. The first interval is low level and the second interval is high level, indicating code element 1, and code element 0 is just the opposite. The opposite rule can also be adopted. The characteristic of this encoding is that there is a level jump in the middle of each code element. The jump in the middle of the bit serves as both a clock signal (which can be used for synchronization) and a data signal, but the bandwidth it occupies is twice the original baseband width. (3) Differential Manchester encoding Differential Manchester encoding is often used for local area network transmission. Its rule is that if the code element is 1, the level of the first half of the code element is the same as the level of the second half of the previous code element. If it is 0, it is the opposite. The characteristic of this encoding is that there is a level jump in the middle of each code element, which can achieve self-synchronization and good anti-interference. (4) 4B/5B coding treats each 4 bits of the data stream to be sent as a group, and then converts it into the corresponding 5-bit code according to the 4B/5B coding rules. There are 32 combinations of 5-bit codes, but only 16 different 4-bit codes are used, and the other 16 are used as control codes (the start and end of the frame, line status information, etc.) or reserved. 2. Digital data modulation to analog signal Digital data modulation technology converts digital signals into analog signals at the transmitting end and restores analog signals to digital signals at the receiving end, corresponding to the modulation and demodulation processes of the modem respectively. The basic modulation methods are: 1) Amplitude shift keying (ASK). Digital signals 1 and 0 are represented by changing the amplitude of the carrier signal, while the frequency and phase of the carrier do not change. It is relatively easy to implement, but the anti-interference ability is poor. 2) Frequency shift keying (FSK). Digital signals 1 and 0 are represented by changing the frequency of the carrier signal, while the amplitude and phase of the carrier do not change. It is relatively easy to implement, has strong anti-interference ability, and is currently widely used. 3) Phase shift keying (PSK). The 1 and 0 of the digital signal are represented by changing the phase of the carrier signal, while the amplitude and frequency of the carrier do not change. It is divided into absolute phase modulation and relative phase modulation. 4) Quadrature Amplitude Modulation (QAM). Under the premise of the same frequency, ASK and PSK are combined to form a superimposed signal. Assuming the baud rate is B, m phases are used, and each phase has n amplitudes, the data transmission rate R of the QAM technology is R=Blog2 (m*n) (unit: b/s) 2ASK uses the carrier with amplitude and without amplitude to represent the digital data "1" and 0 respectively; 2FSK uses two different frequencies to represent the digital data "1" and "0"; 2PSK uses phase 0 and phase π to represent the digital data "1" and "0" respectively, which is an absolute modulation method; 3. Analog data is encoded into digital signals. The most typical example of this encoding method is pulse code modulation (PCM), which is often used to encode audio signals. It mainly includes three steps, namely sampling (refer to the sampling theorem), quantization and encoding. 1) Sampling refers to the periodic scanning of analog signals to convert time-continuous signals into time-discrete signals. According to the sampling theorem, when the sampling frequency is greater than or equal to twice the frequency bandwidth (highest frequency of change) of the analog data, the resulting discrete signal can represent the sampled analog data without distortion. 2) Quantization is to convert the level amplitude obtained by sampling into corresponding digital values according to a certain graded scale and take integers, so as to convert the continuous level amplitude into discrete digital quantities. 3) Coding is to convert the quantization result into the corresponding binary code. 4. Analog data modulation to analog signal In order to achieve transmission efficiency, a higher frequency may be required. This modulation method can also use frequency division multiplexing (FDM) multiplexing technology to make full use of bandwidth resources. The signals transmitted by telephones and local exchange switches use the encoding method of analog signal transmission of analog data; the analog sound data is loaded into the analog carrier signal for transmission.