1 1- decimal numbers the decimal number system has ten digits. these are : 0, 1, 2, 3, 4, 5, 6, 7,...

16
1 1- Decimal Numbers 1- Decimal Numbers The decimal number system has ten digits . These are : 0 , 1 , 2 , 3, 4 , 5 , 6 , 7 , 8 , 9 . The decimal number system has the base = 10 Example -1 - Example -2 - Example -3- : Express the decimal number 897.9 as a sum of the value of each digit . mber systems, Operations, and Codes mber systems, Operations, and Codes

Upload: may-stewart

Post on 02-Jan-2016

224 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: 1 1- Decimal Numbers The decimal number system has ten digits. These are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The decimal number system has the base = 10 Example

11

1- Decimal Numbers1- Decimal Numbers

The decimal number system has ten digits.

These are : 0 , 1 , 2 , 3, 4 , 5 , 6 , 7 , 8 , 9.

The decimal number system has the base = 10

Example -1-

Example -2-

Example -3- : Express the decimal number 897.9 as a sum of the value

of each digit.

Number systems, Operations, and CodesNumber systems, Operations, and Codes

Page 2: 1 1- Decimal Numbers The decimal number system has ten digits. These are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The decimal number system has the base = 10 Example

22

2- Binary Numbers2- Binary Numbers

The binary number system has two digits (bits).

These are : 0 , 1.

The binary number system has the base = 2

The weight of a bit increases from right to left in a binary whole number

Page 3: 1 1- Decimal Numbers The decimal number system has ten digits. These are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The decimal number system has the base = 10 Example

33

Decimal to Binary ConversionDecimal to Binary ConversionMethod : To get the binary number for a given decimal number ,

divide decimal number by 2 until the quotient is 0 .

Remainders form the binary number .

Example -1-

Example -2- : convert the following decimal numbers into

binary:

19 - 45

Page 4: 1 1- Decimal Numbers The decimal number system has ten digits. These are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The decimal number system has the base = 10 Example

44

Binary to Decimal ConversionBinary to Decimal Conversion

Example -1-

Method : Add the weights of all “1”s in a binary number to get the decimal values

Example -2-

Example -3- : convert the following binary numbers

10101110 , 11.011101 into decimal number ?

Page 5: 1 1- Decimal Numbers The decimal number system has ten digits. These are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The decimal number system has the base = 10 Example

55

Convert Decimal Fraction to binaryConvert Decimal Fraction to binary

Method : Repeated multiplication by 2 until fractional part is zero

Example -1-

Example -2- : convert the following decimal numbers into binary:

0.375 0.559

Page 6: 1 1- Decimal Numbers The decimal number system has ten digits. These are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The decimal number system has the base = 10 Example

66

3- Octal Numbers3- Octal Numbers

The Octal number system has 8 digits.

These are : 0 , 1, 2 , 3, 4 , 5 , 6, 7

The Octal system has the base = 8

Assignment:

1. How could we convert Octal to decimal ? give an example .

2. How could we convert Decimal to Octal ? give an example .

3. How could we convert Binary to Octal ? give an example .

4. How could we convert Octal to Binary ? give an example .

Page 7: 1 1- Decimal Numbers The decimal number system has ten digits. These are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The decimal number system has the base = 10 Example

77

Convert Decimal to OctalConvert Decimal to Octal

Divide the given decimal number by base 8 and write the Divide the given decimal number by base 8 and write the reminders starting first reminder from right to left reminders starting first reminder from right to left

Example: (57)Example: (57)1010 = (?) = (?)88

Answer: (71)Answer: (71)88

Or using polynomial of weights, like: … 8Or using polynomial of weights, like: … 833 8 822 8 811 8 800

512 64 8 1512 64 8 1

Example: (413)Example: (413)1010 = 0 6 3 5 = 0 6 3 5

Where: (635)Where: (635)88 = 5.8 = 5.800 + 3.8 + 3.811 + 6.8 + 6.822 = =

5.1 + 3.8 + 6.64 = 5 + 24 + 384 = 5.1 + 3.8 + 6.64 = 5 + 24 + 384 =

(413)(413)1010

Page 8: 1 1- Decimal Numbers The decimal number system has ten digits. These are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The decimal number system has the base = 10 Example

88

4- Hexadecimal Numbers4- Hexadecimal Numbers

The hexadecimal number system has 16 digits.

These are : 0 , 1, 2 , 3, 4 , 5 , 6, 7 , 8 , 9, A , B , C , D , E , F

The hexadecimal system has the base = 16

Page 9: 1 1- Decimal Numbers The decimal number system has ten digits. These are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The decimal number system has the base = 10 Example

99

Convert Decimal to HexadecimalConvert Decimal to Hexadecimal

Divide the given decimal number by base 16 and write Divide the given decimal number by base 16 and write the reminders starting first reminder from right to left the reminders starting first reminder from right to left

Example: (57)Example: (57)1010 = (?) = (?)1616

Answer: (39)Answer: (39)1616

Or using polynomial of weights, like: … 16Or using polynomial of weights, like: … 1622 16 1611 16 1600

256 16 1256 16 1

Example: (413)Example: (413)1010 = 1 9 D = 1 9 D

Where: (19D)Where: (19D)1616 = D.16 = D.1600 + 9.16 + 9.1611 + 1.16 + 1.1622 = =

13.1 + 9.16 + 1.256 = 13.1 + 9.16 + 1.256 =

(413)(413)1010

Page 10: 1 1- Decimal Numbers The decimal number system has ten digits. These are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The decimal number system has the base = 10 Example

1010

Convert between different Number systemsConvert between different Number systems

Base of binary system is 2 = 2Base of binary system is 2 = 211

Base of Octal System is 8 = 2Base of Octal System is 8 = 233

Base of Hexadecimal system is 16 = 2Base of Hexadecimal system is 16 = 244

It means each Hexadecimal digit ~It means each Hexadecimal digit ~ 4 binary digits, and each Octal digit ~4 binary digits, and each Octal digit ~ 3 binary digits3 binary digits

Examples: Convert the binary value 110011000101100Examples: Convert the binary value 110011000101100To the corresponding Octal and hexadecimal valueTo the corresponding Octal and hexadecimal value110 011 000 101 100 = 63054 Octal110 011 000 101 100 = 63054 Octal110 0110 0010 1100 = 662C Hexadecimal!110 0110 0010 1100 = 662C Hexadecimal!

Page 11: 1 1- Decimal Numbers The decimal number system has ten digits. These are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The decimal number system has the base = 10 Example

1111

Hexadecimal Numbers (cont.)Hexadecimal Numbers (cont.)

Binary to hexadecimal

Method:

• Break the binary number into 4-bit groups starting at the right-most bit , Then:

• Replace each 4-bit group with the equivalent hexadecimal symbol.

Page 12: 1 1- Decimal Numbers The decimal number system has ten digits. These are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The decimal number system has the base = 10 Example

1212

Hexadecimal Numbers (cont.)Hexadecimal Numbers (cont.)

hexadecimal to Binary

Method :

Replace each hexadecimal symbol with the appropriate four bits.

Page 13: 1 1- Decimal Numbers The decimal number system has ten digits. These are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The decimal number system has the base = 10 Example

1313

Hexadecimal Numbers (cont.)Hexadecimal Numbers (cont.)

hexadecimal to Decimal

Method Convert the hexadecimal to binary then convert from binary to decimal.

Page 14: 1 1- Decimal Numbers The decimal number system has ten digits. These are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The decimal number system has the base = 10 Example

1414

Hexadecimal Numbers (cont.)Hexadecimal Numbers (cont.)

Decimal to hexadecimal

Method :

Repeated division of a decimal number by 16 .

Page 15: 1 1- Decimal Numbers The decimal number system has ten digits. These are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The decimal number system has the base = 10 Example

1515

Arithmetic Operations Arithmetic Operations 11stst and 2 and 2ndnd Complement Complement

1st complement :

Method : Invert each bit to get the 1st complement

Example -1-

2nd complement :Method -1- : 2nd complement = 1st complement + 1

Example -1-

Example -2- : Determine the first complement of the following binary

00011010 - 11110111 - 10001101

Page 16: 1 1- Decimal Numbers The decimal number system has ten digits. These are : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The decimal number system has the base = 10 Example

1616

Arithmetic Operations Arithmetic Operations 11stst and 2 and 2ndnd Complement (cont.) Complement (cont.)

2nd complement (cont.) :

Method -2- : Change all the bits to the left of the least significant 1 to gets the 2nd complement

Example -1- : Determine the 2nd complement of the following binary

00010110 - 11111100 - 10010001

Application Example