Sie sind auf Seite 1von 8

CHAPTER ONE

NUMBER SYSTEMS AND CODES


Objectives Binary, octal, hexadecimal and BCD number system. Number Conversion

Number Systems and Codes

1.1

Binary Numbers
system is used to represent the voltage levels of a two voltage levels present in a digital circuit, logic The high voltage is +5V and the low voltage is +0V. represent the logic low as a 0 and the logic high as a
Output dalam desimal proses dalam binari Input dalam desimal

The binary number digital circuit. Only High and logic Low. The binary numbers 1.

A calculator is an example of a digital system. Decimal numbers are pressed on the keypad, where the input values are converted to binary for processing, then converts the answers to a decimal value before displaying them. Number conversion occurs extensively in a digital circuit. In this chapter, you will learn numbers systems and codes used in digital circuit. You will also learn how to perform conversion from one number system to another. A decimal number can be converted to a binary number by successively dividing the number by 2 as follows: 87 2 = 43 43 2 = 21 21 2 = 10 10 2 = 5 52=2 22=1 1 2= 0 remainder remainder remainder remainder remainder remainder remainder 1 1 1 0 1 0 1 LSB (right-most bit)

MSB (left-most bit)

Therefore 8710 = 10101112 Note that the first remainder becomes the most significant bit (MSB). The last remainder becomes the least significant bit (LSB). A binary number is converted to a decimal number by summing together the weights of various positions in the binary number which contain a 1. For example, 10101112 = 8710.

Number Systems and Codes MSB 26 1 = = = 25 0 24 1 24 16 23 0 + + 22 1 21 1 LSB 20 1 Bit Weights binary number

+ 26 64 + 8710.

22 + 21 + 20 4 + 2 + 1

1.2 Octal Number


A decimal number can be converted to an octal number by successively dividing the number by 8 as follows: 266 8 = 33 33 8 = 4 48=0 remainder 2 remainder 1 remainder 4 LSD (right-most digit) MSB (left-most digit).

Therefore 26610 = 2148 To convert an octal number to a decimal number, multiply each octal value by the weight of the digit and sum the results. For example, 4128 = 26610. MSD 82 4 = = = (4 x 82 ) + 256 + 26610. LSD 80 Octal Digit Weights 2 Octal Number

81 1 (1 x 81) + 8 +

(2 x 80) 2

Number Systems and Codes

Each octal digit can be represented by a 3-bit binary number as shown below: Octal Digits 0 1 2 3 4 5 6 7 3-bit Binary number 000 001 010 011 100 101 110 111

Conversion from octal to binary is very straightforward. Each octal digit is replaced by 3-bit binary number. For example, 4728 = 100 111 0102. 4 100 7 111 2 001 Octal number Binary number

A binary number is converted into an octal number by taking groups of 3 bits, starting from LSB, and replacing them with an octal digit. For example, 110101102 = 3268. 011 3 010 2 110 6 Binary number Octal number

1.3 Hexadecimal Number


The hexadecimal number uses base 16. It uses the digits 0 through 9 plus the letters A, B, C, D, E and F. The letter A stands for decimal 10, B for 11, C for 12, D for 13, E for 14 and F for 15. Hexadecimal 0 1 2 3 4 Decimal 0 1 2 3 4 Binary 0000 0001 0010 0011 0100

Number Systems and Codes 5 6 7 8 9 A B C D E F 5 6 7 8 9 10 11 12 13 14 15 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

A decimal number can be converted to hex number by successively dividing the number by 16 as follows: 423 16 = 26 26 16 = 1 1 16 = 0 remainder 7 remainder 10 remainder 1 LSB A MSB

Therefore 42310 = 1A716 To convert a hex number to a decimal number, multiply each hex value by the weight of the digit and sum the results. For example, 1A716 = 42310. MSD 82 1 = = = LSD 80 Hex Digit Weights 7 Hex Number

81 A

(1 x 162 ) + (10 x 81) + 256 + 160 + 42310.

(7 x 80) 7

Each hex digit can be represented by a 4-bit binary number as shown above. Conversion from hex to binary is very straightforward. Each hex digit is replaced by 4-bit binary number.

6 For example, 1A716 1 1


=

Number Systems and Codes 1 1010 01112. 7 0111

A 1010

A binary number is converted into an octal number by taking groups of 4 bits, starting from LSB, and replacing them with a hex digit. For example, 110101102 = 3268. For example, 101111110101102 = 2FD616. 10 2 1111 F 1101 D 0110 6

1.4 BCD Code


Conversions between decimal and binary can become long and complicated for large numbers. For example, convert 87410 to binary. The answer is 11011010102, but it takes quite a lot of time and effort to make this conversion. We call this straight binary coding. The Binary-Coded-Decimal (BCD) code makes conversion much easier. Each decimal digit, 0 through 9, is represented with a 4-Bit BCD code as shown below. The BCD code 1010, 1011, 1100, 1101, 1110 and 1111 are not used. Decimal Digit 0 1 2 3 4 5 6 7 8 9 BCD Code 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001

Conversion between BCD and decimal is accomplished by replacing a 4bit BCD for each decimal digit. For example, 87410 = 1000 0111 0100BCD.

Number Systems and Codes 8 7 4 1000 0111 0100 decimal number BCD code

BCD is not another number system like binary, octal, decimal and hexadecimal. It is in fact the decimal system with each digit encoded in its binary equivalent. A BCD code is not the same as a straight binary number. For example, the BCD code requires 12 bits, while the straight binary number requires only 10 bits to represent 87310. 87410 = 87410 = 11011010102 1000 01110100BCD binary BCD

A BCD code is converted into a decimal number by taking groups of 4 bits, starting from LSB, and replacing them with a BCD code. For example, 1100101111000 BCD = 197810 1 1001 0111 1000 1 9 7 8 BCD code decimal number

8 Exercises 1. Convert decimal 23410 to a. binary b. BCD b. octal c. hexadecimal Convert binary 10010111012 to a. decimal b. octal c. hexadecimal d. BCD Convert hexadecimal ABF216 to a. decimal b. binary c. octal d. BCD

Number Systems and Codes

2.

3.

4.

Convert BCD 10010100100110001BCD to a. decimal b. octal c. hexadecimal d. binary Convert number octal 5268 to a. decimal b. BCD c. hexadecimal d. binary

5.

Das könnte Ihnen auch gefallen