Data Conversion Binary Code Formats TM Application Note May 1997 AN9657.1 Introduction Many of the Intersil DSP products have selectable data formats for their input/output interfaces. Table 1 defines the codes as used in these interfaces. Because many applications involve conversion of the analog signals, the analog scale is given as a reference. This table should clarify the interface of the DSP parts to the data conversion device. Table 1 also helps users understand the basis for each of these formats. The following definitions are offered as the basis for each code format: Offset Binary: A binary code in which the code represents analog values between Full Scale and -Full Scale. All zero corresponds to -Full Scale. This code can be balanced by appending a 1 below the LSB. 2’s Complement: A binary code in which positive and negative codes of the same magnitude sum to all zero’s plus a carry. The 2’s complement can be generated from the Offset Binary code by inverting the MSB. A negative number is generated by inverting each bit of the positive number, then adding one. Example: 011 (+3) → 100 + 1 = 101 (-3) 1’s Complement: Bipolar binary code in which positive and negative codes of the same magnitude sum to all one’s. A negative number is generated by investing each bit of the positive number. Example: 011 (+3) → 100 (-3) Sign Magnitude: A binary code in which the MSB represents positive (1) and negative (0) polarities. The code in the table uses a offset binary code to represent the magnitude portion of the number. TABLE 1. BINARY DATA FORMATS FOR DATA CONVERSION SCALE OFFSET BINARY 2’S COMPLEMENT 1’S COMPLEMENT SIGN MAGNITUDE +Full Scale 1111....1111 0111....1111 0111....1111 1111....1111 +0.75 Full Scale 1110....0000 0110....0000 0110....0000 1110....0000 +0.5 Full Scale 1100....0000 0100....0000 0100....0000 1100....0000 +0.25 Full Scale 1010....0000 0010....0000 0010....0000 1010....0000 +0 1000....0000 0000....0000 0000....0000 1000....0000 1111....1111 0000....0000 -0 -0.25 Full Scale 0110....0000 1110....0000 1101....1111 0010....0000 -0.5 Full Scale 0100....0000 1100....0000 1011....1111 0100....0000 -0.75 Full Scale 0010....0000 1010....0000 1001....1111 0110....0000 -Full Scale + 1 LSB 0000....0001 1000....0001 1000....0000 0111....1111 -Full Scale 0000....0000 1000....0000 ----....---- ----....---- 3-1 1-888-INTERSIL or 321-724-7143 | Intersil and Design is a trademark of Intersil Corporation. | Copyright © Intersil Corporation 2000 Application Note 9657 As an example, let’s plot a cosine wave in each of the data formats. Assume that full scale is ±1V. Table 2 details the values of the sampled sinusoid in each of the data formats. Figures 1 through 4 illustrate these signals when converted back to analog using an offset binary converter. TABLE 2. SAMPLED COSINE SIGNAL REPRESENTATION n COS(nπT/16) OFFSET BINARY 2’S COMPLEMENT 1’S COMPLEMENT SIGN MAGNITUDE 0 1 11111 01111 01111 11111 1 0.980785 11111 01111 01111 11111 2 0.92388 11110 01110 01110 11110 3 0.83147 11100 01100 01100 11100 4 0.707107 11010 01010 01010 11010 5 0.55557 11000 01000 01000 11000 6 0.382683 10101 00101 00101 10101 7 0.19509 10010 00010 00010 10010 8 0 10000 00000 00000 10000 9 -0.19509 01100 11100 11101 00010 10 -0.38268 01001 11001 11010 00101 11 -0.55557 00110 10110 10111 01000 12 -0.70711 00100 10100 10101 01010 13 -0.83147 00010 10010 10011 01100 14 -0.92388 00001 10001 10001 01110 15 -0.98079 00000 10000 10000 01111 16 -1 00000 10000 10000 01111 17 -0.98079 00000 10000 10000 01111 18 -0.92388 00001 10001 10001 01110 19 -0.83147 00010 10010 10011 01100 20 -0.70711 00100 10100 10101 01010 21 -0.55557 00110 10110 10111 01000 22 -0.38268 01001 11001 11010 00101 23 -0.19509 01100 11100 11101 00010 24 0 10000 00000 00000 10000 25 0.19509 10010 00010 00010 10010 26 0.382683 10101 00101 00101 10101 27 0.55557 11000 01000 01000 11000 28 0.707107 11010 01010 01010 11010 29 0.83147 11100 01100 01100 11100 30 0.92388 11110 01110 01110 11110 31 0.980785 11111 01111 01111 11111 32 1 11111 01111 01111 11111 3-2 Application Note 9657 32 24 24 8 0 0 COS (nπT/16) -8 -1.0 0 π/2 π 3π/2 2π -16 1.0 ANALOG MAGNITUDE 16 OFFSET BINARY DIGITAL MAGNITUDE ANALOG MAGNITUDE 1.0 32 16 2’S COMPLEMENT 8 0 0 COS(nπT/16) -1.0 0 π/2 TIME (nT) π DIGITAL MAGNITUDE Data Conversion Binary Code Formats -8 3π/2 2π -16 TIME (nT) FIGURE 1. OFFSET BINARY CODE PLOTTING COS(nT) † FIGURE 2. 2’S COMPLEMENT BINARY CODE PLOTTING COS(nT) † 32 32 1.0 COS(nπT/16) 1’S COMPLEMENT 8 0 0 COS(nπT) -1.0 0 π/2 π 16 0 0 SIGN MAGNITUDE -16 DIGITAL MAGNITUDE 16 ANALOG MAGNITUDE ANALOG MAGNITUDE 1.0 DIGITAL MAGNITUDE 24 -8 3π/2 2π -16 TIME (nT) FIGURE 3. 1’S COMPLEMENT BINARY CODE PLOTTING COS(NT) † -1.0 0 π/2 π 3π/2 2π -32 TIME (nT) FIGURE 4. SIGN MAGNITUDE/OFFSET BINARY CODE PLOTTING COS(nT) † † Note that the solid line denotes the regular cosine wave and the dashed line denotes the plot of the digital format code, connected to decimal. All Intersil semiconductor products are manufactured, assembled and tested under ISO9000 quality systems certification. Intersil semiconductor products are sold by description only. Intersil Corporation reserves the right to make changes in circuit design and/or specifications at any time without notice. Accordingly, the reader is cautioned to verify that data sheets are current before placing orders. Information furnished by Intersil is believed to be accurate and reliable. However, no responsibility is assumed by Intersil or its subsidiaries for its use; nor for any infringements of patents or other rights of third parties which may result from its use. No license is granted by implication or otherwise under any patent or patent rights of Intersil or its subsidiaries. For information regarding Intersil Corporation and its products, see web site www.intersil.com 3-3