Page 1039 - The Mechatronics Handbook
P. 1039

TABLE 36.13  Sample Codes
                                             Decimal   BCD        2-out-    Parity          Gray
                                             Digits  8421   2421   of-5  Even   Odd   1-bit  2-bit  3-bit
                                               0     0000   0000  00011  0000 0  0000 1  0   00   000
                                               1     0001   0001  00101  0001 1  0001 0  1   01   001
                                               2     0010   0010  00110  0010 1  0010 0      11   011
                                               3     0011   0011  01001  0011 0  0011 1      10   010
                                               4     0100   0100  01010  0100 1  0100 0           110
                                               5     0101   1011  01100  0101 0  0101 1           111
                                               6     0110   1100  10001  0100 1  0110 0           101
                                               7     0111   1101  10010  0111 1  0111 0           100
                                               8     1000   1110  10100  1000 1  1000 0
                                               9     1001   1111  11000  1001 0  1001 1




                                                      000  001  010  011  100  101  110  111
                                                         SEGMENT
                                                       0   1    2   3   4    5   6    7
                                                    INSULATOR         x   SEGMENT INDICATED AS INDICATOR
                                                         CONDUCTOR   x 2 1 x 0 MOVES FROM SEG-3 TO SEG-4
                                                                     0 1 1  3
                                                                     0 1 0  2  GROSS ERROR (x  misalignment)
                                                                                        0
                                                                     0 0 0  0  GROSS ERROR (x  misalignment)
                                                                                        2
                                                 (a)                 1 0 0  4
                                                      000  001  011  010  110  111  101  100
                                                         SEGMENT
                                                       0   1    2   3   4    5   6    7

                                                    INSULATOR         x  SEGMENT INDICATED AS INDICATOR
                                                         CONDUCTOR   x 2 1 x 0 MOVES FROM SEG-3 TO SEG-4
                                                                     0 1 0  3
                                                                     0 1 0  3
                                                                     1 1 0  4
                                                 (b)                 1 1 0  4

                                 FIGURE 36.1  Eight-segment position sensor with slightly misaligned contacts: (a) binary code physical configu-
                                 ration, (b) Gray code physical configuration.

                                 the same as the reduced radix complement of the code, and this is not true of the BCD code. Thus, the
                                 2421 code facilitates arithmetic with multiple individually coded digit numbers.
                                   There are codes designed to detect errors that may occur in storage or transmission. Examples are the
                                 even and odd parity codes and the 2-out-of-5 code shown in Table 36.13. The 2-out-of-5 error detection
                                 code is such that each decimal value has exactly two high digit values. Parity code attaches an extra bit
                                 having a value such that the total number of high bits is odd if odd parity is used, and the total number
                                 of high bits is even if even parity is used. An even number of bit errors are not detectable by a single bit
                                 parity code. Hence, single bit parity codes are adequate only for sufficiently low bit error rates. Including
                                 a sufficient number of parity bits enables the detection and correction of all errors.
                                   There are codes designed to prevent measurement misrepresentation due to small errors in sensor
                                 alignment. Gray codes are used for this purpose. A Gray code is one in which the codes for physically
                                 adjacent positions are also logically adjacent, that is, they differ in only one binary digit. Gray codes can
                                 be generated for any number of digits by reflecting the Gray code for the case with one less digit, as
                                 shown in Table 36.13, for the case of 1, 2, and 3-bit codes. The advantage of a Gray scale coded lineal
                                 position sensor is illustrated in Fig. 36.1 for the eight-segment case.


                                 ©2002 CRC Press LLC
   1034   1035   1036   1037   1038   1039   1040   1041   1042   1043   1044