You are on page 1of 20

NUMBER SYSTEMS AND CODES

OUTLINE
Binary-to-Decimal Conversions Decimal-to-Binary Conversions Octal Number System Hexadecimal Number System BCD Code Excess-3 Code Gray Code Alphanumeric Code Parity Method for Error Detection

Binary-to-Decimal Conversions
The binary number system is a positional system where each binary digit (bit) carries a certain weight based on its position relative to the LSB 1 1 0 1 12 (binary) 24 + 23 + 22 + 21 + 20 =16+8+2+1 =2710 (decimal)

Decimal-to-Binary Conversions
There are two ways to convert a decimal whole number to its equivalent binarysystem representation. The first method is the reverse of the process described in B-to-D. Another method uses repeated division by 2.

Cont
25 = 12 +remainder of 1 LSB 2 12 =6 +remainder of 0 2 6 =3 +remainder of 0 2 3 = 1 +remainder of 1 2 1 =0 +remainder of 1 MSB 2 2510 = 110012

Octal Number System


The octal number system is very important in digital computer work. The octal number system has a base of eight, meaning that it has eight possible digits: 0,1,2,3,4,5,6, and 7. 84 83 82 81 80 8-1 8-2 8-3 8-4 8-5

Octal-to-Decimal
3728=3x(82) + 7x(81) + 2x(80) = 3x64 + 7x8 + 2x1 = 25010

Decimal-to-Octal
266 = 33 + remainder of 2 8 33 = 4 + remainder of 1 8 4 = 0 + remainder of 4 8 26610 = 4128

Octal-to-Binary
Octal Digit 0 1 2 3 4 5 6 7 Binary Equivalent 000 001 010 011 100 101 110 111

Example: 4728 = 100111010 Binary-to-Octal Example: 100 111 010 4 7 28

Hexadecimal Number System


Hex-to-Decimal 35616 = 3x162 + 5x161 + 6x160 = 768+80+6 = 85410 Decimal-to-Hex
423 = 26 + remainder of 7 16 26 = 1 + remainder of 10 16 1 = 0 + remainder of 1 16 42310 = 1A716

Cont
Hexadecimal
0 1 2 3 4 5 6 7 8 9 A B C D E F

Decimal
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Binary
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

BCD Code
8 7 4 1000 0111 0100 (decimal) (BCD)

Comparison of BCD and Binary 13710 = 100010012 (Binary) 13710 = 0001 0011 0111 (BCD)

Excess-3 Code
Decimal
0 1 2 3 4 5 6 7 8 9

BCD
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001

Excess-3
0011 0100 0101 0110 0111 1000 1001 1010 1011 1100

Gray Code
Decimal Binary Code Gray Code Decimal Binary Code Gray Code

0000

0000

1000

1100

0001

0001

1001

1101

0010

0011

10

1010

1111

0011

0010

11

1011

1110

0100

0110

12

1100

1010

0101

0111

13

1101

1011

0110

0101

14

1110

1001

0111

0100

15

1111

1000

Alphanumeric Code

Baca Halaman 33

Parity Method for Error Detection


The movement of binary data and codes from one location to another is the most frequent operation performed in digital systems Here are some examples:
Transmission of digitized voice over a microwave link The storage and retrieval of data from external memory devices such as magnetic tape and disk The transmission of information from a computer to a remote user terminal or another computer

Parity Bit
Parity bit: A parity bit is an extra bit that is attached to a code group that is being transferred from one location to another. The parity bit is made either 0 or 1, depending on the number of 1s that are contained in the code group.

Cont
Two different methods are used
1. Even-parity 2. Odd-parity

In the even-parity method, the value of the parity bit is choosen so that the total number of 1s in the code group (including the parity bit) is an even number.

Cont-1
The odd-parity method is used in exactly the same way except that the parity bit is chosen so the total number of 1s (including the parity bit) is an odd number. For example even-parity: A1000001 parity bit:0 odd-parity: A1000001 parity bit:1

Tugas hari ini


Ubahlah bilangan berikut ini
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11100012= 10 11001102= 10 8768 = ..10 8788 = 16 91910 = .16 2C016 = 8 28910 = BCD 65416 = . 2 1110011112 = 8 8A716 = 10

You might also like