Number Systems and Codes, Teknik Digital

20
 NUMBER SYSTEMS AND CODES

Transcript of Number Systems and Codes, Teknik Digital

Page 1: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 1/20

 

NUMBER SYSTEMS AND CODES

Page 2: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 2/20

 

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

Page 3: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 3/20

 

Binary-to-Decimal Conversions

• The binary number system is a positionalsystem 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  =27

10 (decimal)

Page 4: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 4/20

 

Decimal-to-Binary Conversions

• There are two ways to convert a decimal

whole number to its equivalent binary-

system representation.

• The first method is the reverse of the

process described in B-to-D.

•  Another method uses repeated division by

2.

Page 5: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 5/20

 

Cont

2101100125 

MSB 1of remainder 02

1

1of remainder 12

3

0of remainder 32

6

0of remainder 6

2

12

LSB 1of remainder 122

25

=

→+=

+=

+=

+=

→+=

Page 6: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 6/20

 

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 possibledigits: 0,1,2,3,4,5,6, and 7.

84 83 82 81 80 8-1 8-2 8-3 8-4 8-5

Page 7: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 7/20

 

Octal-to-Decimal

3728=3x(82) + 7x(81) + 2x(80)

= 3x64 + 7x8 + 2x1= 250

10

Page 8: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 8/20

 

Decimal-to-Octal

810412266 

4of remainder 08

4

1of remainder 48

33

2of 338

266

=

+=

+=

+= remainder 

Page 9: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 9/20

 

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

Page 10: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 10/20

 

Hexadecimal Number System

Hex-to-Decimal

35616

= 3x162+ 5x161+ 6x160

= 768+80+6 = 85410

Decimal-to-Hex

16101A7423 

1of 016

1

10of 1

16

26

7of 2616

423

=

+=

+=

+=

remainder 

remainder 

remainder 

Page 11: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 11/20

 

Cont

Hexadecimal Decimal Binary0 0 0000

1 1 0001

2 2 0010

3 3 0011

4 4 01005 5 0101

6 6 0110

7 7 0111

8 8 1000

9 9 1001

A 10 1010

B 11 1011

C 12 1100

D 13 1101

E 14 1110

F 15 1111

Page 12: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 12/20

 

BCD Code

8 7 4 (decimal)

1000 0111 0100 (BCD)

Comparison of BCD and Binary

13710

= 100010012

(Binary)

13710 = 0001 0011 0111 (BCD)

Page 13: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 13/20

 

Excess-3 Code

Decimal BCD Excess-30 0000 0011

1 0001 0100

2 0010 01013 0011 0110

4 0100 0111

5 0101 1000

6 0110 1001

7 0111 1010

8 1000 1011

9 1001 1100

Page 14: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 14/20

 

Gray Code

Decimal Binary Code Gray Code Decimal Binary Code Gray Code

0 0000 0000 8 1000 1100

1 0001 0001 9 1001 1101

2 0010 0011 10 1010 1111

3 0011 0010 11 1011 1110

4 0100 0110 12 1100 1010

5 0101 0111 13 1101 1011

6 0110 0101 14 1110 1001

7 0111 0100 15 1111 1000

Page 15: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 15/20

 

 Alphanumeric Code

• Baca Halaman 33

Page 16: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 16/20

 

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 

Page 17: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 17/20

 

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.

Page 18: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 18/20

 

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 evennumber.

Page 19: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 19/20

 

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: A→1000001→parity bit:0

odd-parity: A→1000001→parity bit:1

Page 20: Number Systems and Codes, Teknik Digital

7/27/2019 Number Systems and Codes, Teknik Digital

http://slidepdf.com/reader/full/number-systems-and-codes-teknik-digital 20/20

 

Tugas hari ini

• Ubahlah bilangan berikut ini1. 1110001

2= …………10

2. 11001102= …………10

3. 8768 = ……………..104. 878

8= ………………16

5. 91910

= …………….16

6. 2C016

= ……………8

7. 28910

= ……………BCD

8. 65416= ……………. 2

9. 1110011112= ……… 8

10. 8A716= …………… 10