McGraw-Hill CreateTM Review Copyfor Instructor Nicolescu.Not fordistribution.IntroductiontoMechatronicsandMeasurementSystems,FourthEdition413859.2PositionandSpeedMeasurementfixedsensorsbit 3 (MSB)bit 0 (LSB)83600direction of positive track motionbit30bit20bit 11bit oFigure9.1334-bitgraycodeabsoluteencoderdisktrackpatterns.fixedsensorsbit2bit 1bito(LSB)[3360°direction of positive track motionbit301bit 20-bit 10bito0(a) schematic and signals(b) actual disk (Courtesy of ParkerCompumotor Division, Rohnert Park, CA)Figure9.14 4-bit natural binaryabsolute encoderdisk trackpatterns.Because the gray code provides data with the least uncertainty but the naturalbinary code is the preferred choice for direct interfaceto computers and other digi-tal devices, a circuit to convert from gray to binary code is desirable. Figure 9.15showsa simplecircuitthatutilizesExclusiveOR心(XOR)gatestoperformthis
Confirming Pages Figure 9.13 4-bit gray code absolute encoder disk track patterns. direction of positive track motion fixed sensors bit 3 (MSB) bit 2 bit 1 bit 0 (LSB) 0° 360° bit 3 1 0 bit 2 1 0 bit 1 1 0 bit 0 1 0 Figure 9.14 4-bit natural binary absolute encoder disk track patterns. (b) actual disk (Courtesy of Parker Compumotor Division, Rohnert Park, CA) (a) schematic and signals direction of positive track motion fixed sensors bit 3 (MSB) bit 2 bit 1 bit 0 (LSB) 0° 360° bit 3 1 0 1 0 1 0 1 0 bit 2 bit 1 bit 0 9.2 Position and Speed Measurement 385 Because the gray code provides data with the least uncertainty but the natural binary code is the preferred choice for direct interface to computers and other digital devices, a circuit to convert from gray to binary code is desirable. Figure 9.15 shows a simple circuit that utilizes Exclusive OR (XOR) gates to perform this alc80237_ch09_375-430.indd 385 lc80237_ch09_375-430.indd 385 10/01/11 10:09 PM 0/01/11 10:09 PM Introduction to Mechatronics and Measurement Systems, Fourth Edition 41 McGraw-Hill Create™ Review Copy for Instructor Nicolescu. Not for distribution
McGraw-Hill CreateTM Review Copyfor Instructor Nicolescu.Not fordistribution.42MeasurementSystems386CHAPTER9SensorsTable9.14-bitgray and natural binary codesNatural binaryGray codeDecimal CodeRotation Range()code (B,B,B,Bo)(G,G,G,G)00-22.500000000122.5450001000124567.500100011367.59000110010490-112.5010001105112.5135010101116135157.501100101701110100157.5-180810001100180-202.591001202.5225110110225-247.510101111111011111024 7.52701211001010270-292.5131101292.531510111411101001315337.51511111000337.5360MSBG,o-O B,OB2G,0OB,G,OOBoG.oLSBFigure9.15Gray-code-to-binary-codeconversion.function.TheBooleanexpressionsthat relatethebinarybits(B,)tothegray codebits (G)areB, = G3B2 = B, ④G2(9.1)BI = B2 @ GIBo= B, ④ GoFor a gray-code-to-binary-code conversion of any number of bits N (e.g., N = 4 aspreviously),themost significant bits of the binary and gray codes are always identi-cal (BN-1 = Gn-1), and for each other bit, the binary bit is the XOR combination:B,=Bi+1 @ G,for i = 0 to NI-2.Thispatterncanbeeasilyseeninthe4-bitexample above (Equations 9.1)
Confirming Pages Table 9.1 4-bit gray and natural binary codes Decimal Code Rotation Range () Natural binary code (B3B2B1B0) Gray code (G3G2G1G0) 0 0–22.5 0000 0000 1 22.5–45 0001 0001 2 45–67.5 0010 0011 3 67.5–90 0011 0010 4 90–112.5 0100 0110 5 112.5–135 0101 0111 6 135–157.5 0110 0101 7 157.5–180 0111 0100 8 180–202.5 1000 1100 9 202.5–225 1001 1101 10 225–247.5 1010 1111 11 24 7.5–270 1011 1110 12 270–292.5 1100 1010 13 292.5–315 1101 1011 14 315–337.5 1110 1001 15 337.5–360 1111 1000 Figure 9.15 Gray-code-to-binary-code conversion. MSB LSB G3 B3 G2 B2 G1 G0 B1 B0 386 C H A P T E R 9 Sensors function. The Boolean expressions that relate the binary bits ( Bi ) to the gray code bits ( Gi ) are B3 = G3 B2 = B3 ⊕ G2 B1 = B2 ⊕ G1 B0 = B1 ⊕ G0 (9.1) For a gray-code-to-binary-code conversion of any number of bits N (e.g., N 4 as previously), the most significant bits of the binary and gray codes are always identical ( BN 1 GN 1 ), and for each other bit, the binary bit is the XOR combination: Bi Bi 1 1 Gi for i 0 to N 2. This pattern can be easily seen in the 4-bit example above ( Equations 9.1 ). alc80237_ch09_375-430.indd 386 lc80237_ch09_375-430.indd 386 10/01/11 10:09 PM 0/01/11 10:09 PM 42 Measurement Systems McGraw-Hill Create™ Review Copy for Instructor Nicolescu. Not for distribution.