You are on page 1of 31

Lecture No 1

NUMBER SYSTEMS AND


CONVERSIONS
In this lecture…
• Decimal numbering system (Base 10)
• Binary numbering system (Base 2)
• Binary to decimal conversion
• Decimal to binary conversion
• How to write binary sequence?
• Octal numbering system (Base 8)
• Binary to octal conversion
• Decimal to octal conversion
• Octal to decimal conversion
• Hexadecimal number systems
• Binary coded decimal system
• Alphanumerical code
Number Systems

• To talk about binary data, we must first


talk about number systems

• The decimal number system (base 10)


you should be familiar with!

• Positional number system


Positional Notation
•Value of number is determined by multiplying each
digit by a weight and then summing.

a3a2a1a0.a1a2 
a3  r 3  a2  r 2  a1  r1  a0  r 0  a1  r 1  a2  r 2

•The weight of each digit is a POWER of the RADIX


(also called BASE) and is determined by position.
Radix (Base) of a Number
System
• Decimal Number System (Radix = 10)
Eg:- 7392 = 7x103+3x102+9x101+2x100

• Binary Number System (Radix = 2)


Eg:- 101.101 = 1x22+0x11+1x20+1x2-1+0x2-2 +1x2-3

• Octal number system (radix = 8)

• Hexadecimal number system (radix = 16)


Decimal numbering system
(Base 10)
• Weighting factor base on a power of 10.
• In the decimal numbering system each position
contains 10 different possible digits. From 0 to 9.
• Example:
123

1102 + 2101 + 3100


or
1 hundred, 2 tens and 3 units
Binary numbering system
(Base 2)
• Weighting factor is based on 2.
• Digital electronics use the binary numbering system
because it uses only the digits 0 and 1.
• Which can be represented simply in a digital system by two
distinct voltage levels, such as +5V = 1 and 0V = 0.
• Example:
1111011

126 + 125 + 124 + 123 + 022 + 121 + 120

= 164 + 132 + 116 + 18 + 04 + 12 + 11


= 123
Binary to decimal conversion
• 010101102
27*0 + 26*1 + 25*0 + 24*1+ 23*0+22*1+21*1+20*0
= 85 Answer

• 1011.10102
23*1+ 22*0+21*1+20*1. 2-1*1 +2-2*0 +2-3*1 +2-4*0
8 + 0 + 2 + 1.1/2 + 0 + 1/8 + 0
=11.625 Answer

• 11112
23*1 +22*1 +21*1 +20*1
8*1+ 4*1+ 2*1+ 1*1
8+4+2+1=15 Answer
Binary Numbers
• Each binary digit (called bit) is either 1 or 0
• Bits have no inherent meaning, can represent
– Unsigned and signed integers
– Characters
Most Least
– Floating-point numbers Significant Bit Significant Bit
– Images, sound, etc. 7 6 5 4 3 2 1 0
1 0 0 1 1 1 0 1
• Bit Numbering 27 26 25 24 23 22 21 20

– Least significant bit (LSB) is rightmost (bit 0)


– Most significant bit (MSB) is leftmost (bit 7 in an 8-bit
number)
Data Organization
• Bits
– or one, true or false, on or off, male or
female, and right or wrong.
• Nibbles
– Group of 4 bits
Bytes
Words
Double Words
Decimal to binary
conversion
• 133 10 = (?)2
Substitute by the nearest or smallest value.
133
- 128 = 27
5
- 4 = 22
1
- 1 = 20
0

• (10000101)2 =27*1+22*1+2 0 *1
=128+4+1
= 133 Answer
Decimal to binary
conversion
• 12210= (?)2
122
-64 =26
58
- 32 =25
26
16=204
10
- 8= 23
2
- 2= 21
0

(01111010) Answer
Successive division
• Another method to convert decimal into binary is called
successive division.

12210= (?)2 Bit


2 122 Remainder 0
2 61 Remainder 1
2 30 Remainder 0
2 15 Remainder 1
2 7 Remainder 1
2 3 Remainder 1
1 Remainder 1

(1111010) Answer
Successive division
15210= (?)2
Home work: take
2 152 Remainder 0 10 different values in
2 76 Remainder 0 binary and decimal
2 38 Remainder 0 and perform these
2 19 Remainder 1 conversions
2 9 Remainder 1
2 4 Remainder 0
2 2 Remainder 0

(0011000)Answer
Binary sequence
• How to write binary 00
22=4 23=8
000
24=16
0000

sequence? 01
10
001
010
0001
0010
11 011 001
• Formula of counting 00
01
100
101
0100
0101

range 2n=M. 10
11
110
111
0110
0111
00 000 1000

• Where n is the number 01


10
001
010
1001
1010

of bits and M is the 11


00
011
100
1011
1100
10 101 1101
length of the sequence. 10
11
110
111
1110
1111

• Write the binary


sequence with the help
of formula.
Octal numbering system
(Base 8):
• The octal numbering system Decimal Octal
0 0
is a method of grouping 1 1
2 2
binary numbers in groups of 3 3
4 4
three (3 bit). 5 5

• Weighting factor is power of


6 6
7 7
8 10
8. 9 11
10 12
• The range is from 0 to 7. . .
. .
19 17
20 ?
Examples: Binary to octal
conversion:
Convert 011.101 to octal.
0*22+1*21+1*20.1*22+0*21+1*20
(3.5)8 Answer

Convert 6248 tobinary:


6= 22 21 20 = 110
2= 22 21 20 =010
4=22 21 20 =100
(110010100)2 Answer

Convert 2718 to binary.


2= 22 21 20 = 010
7= 22 21 20 = 111
1= 22 21 20 = 001
(010111001)2 Answer
Examples: Convert decimal to
octal
 Convert 17710 to octal.
 Convert 26610 tooctal.

8 177 Remainder 1 8 266 Remainder 2


8 22 Remainder 6
8 33 Remainder 1
8 2 Remainder 2
8 4 Remainder 4
(261)8Answer
(412)8Answer

 Convert 404 to octal.

8 404 Remainder 4

8 50 Remainder 2

8 6 Remainder 6

(624)8Answer
Hexadecimal numbering
s–yTshteehmexadecimal numbering
Decimal Hexadecimal
system is like the octal system, is O O
1 1
the method of grouping bit to 2
3
2
3
simplify entering and reading the 4
5
4
5
6 6
instructions or data present in 7 7
8 8
digital computer system. 9
10
9
A
11 B
– It uses 4 bit groupings. 12
13
C
D

– Weighting factor is power of 16 14


15
E
F

– The range is from o to F.


– Represent as 6H, 616.
– One hexadecimal digit=4 binary
bits.
Hexadecimal conversions
• Convert 001010101 into (?)16
0001 0101 0100
155HAnswer

• Hexadecimal to decimal
i) 2A616 = (?)10
2*162+10*161+6*160
512+160+6
67810Answer

1BC216= (?)10
ii) 1*163+11*162+12*161 2*160
+
4096+2816+192+2
710610Answer
Convert decimal to
hexadecimal
• 15110 to hexadecimal

1*162+5*161+1*160
256+80+1
337HAnswer.

• Convert 214 to hexadecimal.

16 214 Remainder 6
16 13 Remainder 13
(D6)16Answer
Binary coded decimal
system:
• A group of binary 0’s and 1’s can be thought of as a code of
representation the decimal number when a decimal number
is represented by its equivalent binary number w call it
straight binary coding.

• Straight binary code:


• Binary coded decimal (BCD) system is used to represent
each of 10 decimal digits as a 4 bit binary code.

999

1001
1001
1001
100110011001 BCD
Decimal Binary Octal Hexadecimal BCD
0 0000 0 0 0000
1 0001 1 1 0001
2 0010 2 2 0010
3 0011 3 3 0011
4 0100 4 4 0100
5 0101 5 5 0101
6 0110 6 6 0110
7 0111 7 7 0111
8 1000 10 8 1000
9 1001 11 9 1001
10 1010 12 A 1010
11 1011 13 B 1011
12 1100 14 C 1100
13 1101 15 D 1101
14 1110 16 E 1110
15 1111 17 F 1111

1 Nibble= 4 bits 1byte= 8 bits


1 word= group of bits that represent a unit of information.
• Q. What is the largest value of
decimal by using these 2 bytes?

• Ans. 2 bytes = 16 bits


• 2n=M
• 216= 65536
• 216-1=65535.Answer
• Q. how many bytes are needed to
represent 846569 in BCD?
Alphanumerical code:
• ASCCI (American Standard Codes
for Information Interchange).
• The ASCII codes a seven bit code,
and so it has 27=128 possible code
groups.
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.
• 1) Even parity (01000001)
• 2) Odd parity (1100001)

• Write down the ASCII code for HELLO even parity.


• Even odd
• H= 01001000 1
• E= 11000101 0
• L= 11001100 0
• L= 11001100 0
• O= 11001111 0

You might also like