Introduction to the code system of rotary code switches?
来源:Dongguan Yanghan Industrial Co., Ltd.  时间:2023-06-20
A rotary code switch, also known as a rotary encoder or rotary switch, is a common input device that is often used to adjust volume, frequency, etc. Its code system usually has Gray code, binary code, BCD code, etc.
1. Gray code
Gray code is a binary code. Only one bit is different between two adjacent codes, which can reduce the error rate and improve reliability. For example, the sequence of 4-bit Gray code is as follows: 0000, 0001, 0011, 0010, 0110, 0111, 0101, 0100, 1100, 1101, 1111, 1110, 1010, 1011, 1001, 1000
Gray code can be derived from the binary code, the specific method can refer to the relevant algorithm books.
2. Binary code
Binary code is a common way to encode numbers, each bit can only represent 0 or 1, such as 0000, 0001, 0010, 0011, 0100, etc. When using binary codes in rotary coding switches, for each rotation step, the value represented is added or subtracted by a fixed amount, often in increments of 1.
3. BCD codes
BCD code is an abbreviation for Binary-CodedDecimal, which is a binary-coded decimal number. For example, the BCD codes for the numbers 0-9 are as follows:
4.BCD Complement
Similar to binary complement, BCD code represents the complement of a number. The calculation method of BCD complement can be found in related algorithm books.
5. Gray's complement
Gray's complement is a digital code representation used to perform digital operations in computer systems. Its calculation method is similar to binary complement, the original code is inverted and added by 1 to get its complement. The calculation of Gray's complement can be found in related algorithm books. In numerical operations, it can be used to implement operations such as addition and subtraction to improve the efficiency of numerical operations.