Docsity

Number Systems and Digital Electronics, Study notes of Computer Science

Toggle sidebar
bg1
BSCS 1201: Digital logic and electronic circuits
Lec
t
ure
1
I
n
t
roduc
ti
on
t
o
Number
Sy
st
em
s
Wha
t is
d
i
g
it
a
l l
og
i
c
:
D
i
g
it
a
l l
og
i
c
i
s
t
he
unde
rl
y
i
ng
l
og
i
c
sys
t
em
t
ha
t
d
ri
ves
e
l
ec
tr
on
i
c
c
ir
cu
it
boa
r
d
des
i
gn.
D
i
g
it
a
l l
og
i
c
i
s
t
he
man
i
pu
l
a
ti
on
of
b
i
na
r
y
va
l
ues
t
h
r
ough
p
ri
n
t
ed
c
ir
cu
it
boa
r
d
t
echno
l
ogy
t
ha
t
uses
c
ir
cu
it
s
and
l
og
i
c
ga
t
es
t
o
cons
tr
uc
t t
he
i
mp
l
emen
t
a
ti
on
of
compu
t
e
r
ope
r
a
ti
ons.
D
i
g
it
a
l l
og
i
c
i
s
a
common
pa
rt
of
e
l
ec
tri
ca
l
eng
i
nee
ri
ng
and
des
i
gn
cou
r
ses.
Why
number
s
y
st
em
s
are
i
mpor
t
an
t
for
d
i
g
it
a
l
e
l
ec
t
ron
i
c
s:
d
i
g
it
a
l
e
l
ec
tr
on
i
c
dev
i
ces
use
d
i
g
it
a
l
dev
i
ces
mean
i
ng
t
hey
a
r
e
d
i
g
it
a
l i
n
t
he
ir
des
i
gn.
They
unde
r
s
t
and
t
wo
s
t
a
t
es
ON
and
OFF.
These
t
wo
s
t
a
t
es
a
r
e
r
ep
r
esen
t
ed
us
i
ng
t
wo
d
i
g
it
s
1
fo
r
ON
and
0
fo
r
OFF.
Th
i
s
i
s
t
he
r
eason
t
hey
a
r
e
ca
ll
ed
d
i
g
it
a
l
dev
i
ces.
The
d
i
g
it
s
1
and
0
a
r
e
i
n
a
numbe
r
sys
t
em
ca
ll
ed
B
i
nary
number
s
y
st
em.
{
0
,
1
}
Wha
t is
a
Number
Sy
st
em
: it i
s
a
sys
t
em
of
r
ep
r
esen
ti
ng
numbe
r
s
us
i
ng
a
se
t
of
d
i
g
it
s
and
a
l
phabe
t
s.
Examp
l
e
1
:
Dec
i
ma
l
Number
Sy
st
em
Fo
r
examp
l
e
, t
he
dec
i
ma
l
number
s
y
st
em
s i
s
t
he
common
l
y
used
numbe
r
sys
t
em
and
it r
ep
r
esen
t
s
numbe
r
s
us
i
ng
a
se
t
of
t
en
d
i
g
it
s
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
}
10
,
11
,
12
,
13…
19
,
20…29
,
30…39
,
90..99
,
100
,
101…999
,
1000…9999…
1
,
000
,
000
The
t
o
t
a
l
numbe
r
of
d
i
g
it
s
and
a
l
phabe
t
s
used
t
o
r
ep
r
esen
t
a
ll t
he
numbe
r
s
i
n
a
numbe
r
sys
t
ems
i
s
ca
ll
ed
a
base
or
a
rad
i
x
a
numbe
r
sys
t
em
The
r
efo
r
e
,
dec
i
ma
l
numbe
r
sys
t
em
has
10
d
i
g
it
s
used
t
o
r
ep
r
esen
t
a
ll
t
he
numbe
r
s
i
.e.
{0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9}
hence
it
s
base
i
s
10
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26

Partial preview of the text

Download Number Systems and Digital Electronics and more Study notes Computer Science in PDF only on Docsity!

BSCS 1201: Digital logic and electronic circuits

Lecture 1 Introduction to Number Systems What is digital logic: Digital logic is the underlying logic system that drives electronic circuit board design. Digital logic is the manipulation of binary values through printed circuit board technology that uses circuits and logic gates to construct the implementation of computer operations. Digital logic is a common part of electrical engineering and design courses. Why number systems are important for digital electronics: digital electronic devices use digital devices meaning they are digital in their design. They understand two states ON and OFF. These two states are represented using two digits 1 for ON and 0 for OFF. This is the reason they are called digital devices. The digits 1 and 0 are in a number system called Binary number system. { 0 , 1 } What is a Number System: it is a system of representing numbers using a set of digits and alphabets. Example 1 : Decimal Number System For example, the decimal number systems is the commonly used number system and it represents numbers using a set of ten digits { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } 10 , 11 , 12 ,13… 19 , 20 … 29 , 30 … 39 , 9 0.. 99 , 100 , 10 1… 999 , 1000 …9999… 1 , 000 , 000 The total number of digits and alphabets used to represent all the numbers in a number systems is called a base or a radix a number system Therefore, decimal number system has 10 digits used to represent all the numbers i.e. {0, 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ,9} hence its base is 10

On the other hand the Binary number system has 2 digits used to represent all the numbers i.e { 0 ,1} hence the base or radix of binary number system is 2 The number 210 in binary = (^102) problem How many two digit numbers can be formed using base 10 Solution Since decimal number system has symbols 0 to 9 any number after 9 is a combination of the ten digits in the set { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } The total number of two digits numbers that cab be formed are 102 = 100 i.e { 00 , 01 … 10 … 19 …20..29…90.. 99 } 103 = 1000 { 000 , 001… 999 } The total number of the digits and symbols in the set used to represents numbers in the number system is called the base or the radix Hence base or Radix (r) of the decimal number systems is 10 To show the base or radix of a number in a number system we use a subscript at the end of the number. E.g. to show that 386 is a base 10 number we write it as 38610 = 3 hundreds, 8 tens and 6 ones = 3.1 02 +8.10^1 +6.10^0 = 300+80+6= (^38610) consider the number 438610 = 4. 103 + 3.1 02 +8.1 01 +6.10^0 the expansion is as follows 4 3 8 6 Power of base 103 102 101 100 4.1 03 3.1 02 8.10^1 6.1 00 Example 2 : Binary Number system This number systems uses two digits {1, 0 } decimal 0 1 2 3 4 5 6 7 8 9 10 binary 0 1 10 11 100 101 110 111 1000 1001 1010

 given radix (base) r = 3 then the set of digits is

{0…3-1} = {0…2} i.e {0,1, 2 }

 given radix (base) r = 8 then the set of digits is

{0…8-1} = {0…7} i.e {0,1,2,3,4,5, 6 ,7}

 given radix (base) r = 12 then the set of digits

is {0…1 2 - 1} = {0…11}

NB: the number 10, 11 etc consists of 2 digits

hence we label them as A, B hence set of

digits in base 12 is {0,1,2,3,4,5,6,7,8, 9 ,A,B}

 given radix (base) r = 16 then the set of digits

is {0…1 6 - 1} = {0…15}

NB: the number 10, 11,12,13, 14 ,15 etc

consists of 2 digits hence we label them as A,

B,C,D,E,F hence set of digits in base 16 is

{0,1,2,3,4,5,6, 7 ,8,9, A, B,C,D,E,F }

 given radix (base) r = 6 then the set of digits is

hence set of digits in base 6 is {0,1,2, 3 ,4, 5 }

Weighted number systems

All the examples given are weighted number

systems

How to expand weighted number systems

e.g 1 given 745 610 in radix(base) 10

3

2

1

0

e.g two … given 101 01112 radix (base) 2

expand in weighted format

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

  1. 26 0. 25 1. 24 0. 23 1. 22 1. 21 1. 20 64 0 16 0 4 2 1

6

5

4

3

2

1

0

After expanding any number system the final

answer is in base 10.

All weighted number systems when

expanded are converted to base 10

HOW TO CONVERT BETWEEN NUMBER SYSTEMS

1. CONVERTING ALL OTHER NUMBER SYSTEMS TO BASE 10 IS DONE THROUGH EXPANSIONThis is done by expanding the given number in any radix according to the weights and getting the total

e.g one … given 10101112 radix (base) 2

expand in weighted format

6

5

4

3

2

1

0

6

5

4

3

2

1

0

Hexadecimal number system …. radix (base) 16 {0, 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ,A,B,C,D,E,F} Where 16 = 24 (means 4 binary digit – bits make a hexadecimal number ) Why octal and hexadecimal are important: the main reason is that binary numbers can be too long and consume a lot of memory hence we can use octal or hexadecimal to group them and reduce the memory space occupied. In other words Octal and hexadecimal have a high information storage capacity.

Example 1

The binary number 111100101010101111010 12 has 22

digits. Hence if storing each digit require 1 byte of

storage we need 1. 22 = 22 bytes of memory

Converting the binary number

11110010101010111101012 to octal we take three

binary digits from right and make them one octal

number

OCTAL (

3

=8) i.e every three binary digits make them

one octal number

2

1

0

We have 8 digits hence the memory required to store

the number has reduced to 1. 8 = 8 bytes

Example

Convert 7658 to binary

example

Convert 2658 to binary

Convert 6258 to binary

HEXADECIMAL (BASE 16 = 2

4

) i.e COMBINE every FOUR

binary digits make them one HEXADECIMAL number

e.g one convert 8710 to base 2

number

divided

rem

ai

n

der

Confirm that 1010111 2 = 8 710

6

5

4

3

2

1

0

e.g two convert 9710 to base 5

number

divided

remain

der

Confirm that 3 425 = 9 710

2

1

0

Eg three convert 964 610 to base 12

number

divided

remain

der

Confirm that 56 BA 12 = 964610

Solution (please do this)

COMMON NUMBER SYSTEMS USED IN

DIGITAL COMPUTERS ARE:

Binary ---- radix (base) 2

Octal ------ radix (base) 8

Hexadecimal number system …. radix

(base) 16

3. Inter conversion between binary, octal and

hexadecimal

 Reason for using binary in digital computers is

because the digital computer operate in TWO

states ON and OFF

ON is represented as 1 while OFF is

represented as 0

 Reason for using octal and hexadecimal number

systems in digital computers

They have high information density (they can use a

small memory to store a large binary number)

Octal is base 8 = 2

3

--- this means the octal

number system can be easily converted to

base 2 since any digit in octal system is

equivalent to 3 bits ( 2

3

e.g convert 78 to base 10 then to base 2

digits in base 8 {0,1,2,3,4,5,6,7}

0

101011101 101 011 101 5 3 5 11110100

678 to base 10 = 6. 8

1

0

number

divided

remain

de

r

Conclusion: to convert any base 8 number to base 2

convert each digit to its binary equivalent in 3 bits

168 to base 2 = 001110 = 11102

758 to base 2 = 2

Convert the number 2 to octal Group the bits into 3 ’s from the least significant i.e. from right to left and convert each group to a base 1 0 number Therefore 101011101 2 = (^5358) 3648 = (^2)

Hexandecimal is base 16 = 2

4

- -- this means

the hexadecimal number system can be easily

converted to base 2 since any digit in

hexadecimal system is equivalent to 4 bits (

4

e.g convert 8AB 16

to base 10 then to base

2

1

0

number divided remainder

1000101 0 (^10112)

1 mega byte = 2 20 bits

1 gigabyte = 2 30 bits 1 byte in base 16 is represented using 2 hexadecimal digits while in base 2 it is 8 binary digits 110. (^1012) https://learnabout-electronics.org/Digital/dig1 1 .php 111010112 = (^3538) AB6 16 = (^1010101101102) A=10 B= 11 6 1010 1011 0110

Convert 13. 62510 to base 8 =

1= 001 3 = 011 the whole number part is 001011 = 1011 The decimal number .6 = 110 2= 010 and 5 = 101 the answer is .1 10010101

13 .625 base 10 = 1011. 110010101

Convert 13.6 25 base 10 to base 16

13 .625 in binary is 1011. 110010101

Hence 1011. 1 in base 16 is

Whole number part

The decimal part. 1100 = 12(C) 1010 = 10 (A) 1000 = 8

13 .CA

How to represent negative and positive integers in

computers

negative and positive integers are called signed (+ or - )

numbers

to represent positive add 1 infront of the number e.g

INTRODUCTION TO BOOLEAN ALGERA To design digital circuits we also need to understand Boolean algebra which is the foundation of Boolean logic gates (a gate has two options which are Open or Closed – this two states can be represented using digits 1 for closed and 0 for open) What is Boolean algebra: logic algebra that deals with truth values of statements ---- for digital logic design we use the two values True i.e T = 1 which means a close switch with high voltage and False i.e F =0 which means open switch or low voltage Example consider this switch in series This an example of an AND gate (for current to flow switches A AND

B MUST be both closed) – the AND gate has switches in series and

it is represented using a dot or a multiplication in normal

maths

How many combinations of this switch can we have?

dec A B output Boolean output current 0 0 0 0 (no current) A’.B’ off 1 0 1 0 (no current) A’.B off 2 1 0 0 (no current) A.B’ off 3 1 1 1 (current) A.B on

For 2 switches there are 2

2

= 4 possible combinations

0

1

With 2 switches number of combinations of the state of the

switches Is 4 (

2