You are on page 1of 61

WELCOME DEE 2034

DIGITAL ELECTRONICS

introduces the theories on the basic of digital systems.


This course emphasizes on the digital system
fundamentals and applications.
covers number systems, code system, logic gates,
Boolean operations, combinational circuits, flip-flops,
counters and registers.

dee Copyright 2000 Indiana University Board of Trustees


2034
1
CHAPTER 1:

dee Copyright 2000 Indiana University Board of Trustees


2034 2
DEE2034 : DIGITAL ELECTRONICS
Course Learning Outcomes, CLO
Upon completion of this course, students should be able
to:
CLO 1 :
apply the knowledge of various number systems codes,
logic operations and logic gates in digital systems. (C3,
PLO1).

Copyright 2000 Indiana University Board of Trustees


dee 2034
3
SUMMARY
NUMBER AND CODE SYSTEMS
Decimal,
binary,
octal and
hexadecimal number systems;
Twos complement systems;
BCD 8421 and ASCII Code.
dee Copyright 2000 Indiana University Board of Trustees
2034 4
Introduction to Numbering Systems
We are all familiar with the decimal
number system (Base 10). Some other
number systems that we will work with
are:
Binary Base 2 (N2 )
Octal Base 8 (N8 )
Hexadecimal Base 16 (N16 )

dee Copyright 2000 Indiana University Board of Trustees


2034 5
Characteristics of Numbering
Systems
1) The digits are consecutive.
2) The number of digits is equal to the size of
the base.
3) Zero is always the first digit.
4) The base number is never a digit.
5) When 1 is added to the largest digit, a sum of
zero and a carry of one results.
6) Numeric values determined by the have
implicit positional values of the digits.

dee Copyright 2000 Indiana University Board of Trustees


2034 6
Significant Digits
Binary: 11101101

Most significant digit Least significant digit

Hexadecimal: 1D63A7A

Most significant digit Least significant digit

dee Copyright 2000 Indiana University Board of Trustees


2034 7
Decimal Number System (N10 )
In the decimal number system each of the ten
digits
( 0,1,2,3,4,5,6,7,8,9) represents a certain quantity.
The various digits in in appropriate positions
within a number to indicate the magnitude of the
quantity.

dee Copyright 2000 Indiana University Board of Trustees


2034 8
The digit 2 has a weight The digit 3 has a
weight
of 10 in this position. of 1 in this
position.

2 3

2X10 + 3X1

20 + 3

23

dee Copyright 2000 Indiana University Board of Trustees


2034 9
The position of each digit in decimal
number indicates the magnitude of
the quantity represented and can be
assigned a weight.
The weight for whole numbers are
positive powers-of-ten that increase
from right to left, beginning with 100
= 1.

.. 105 104 103 102 101 100

dee Copyright 2000 Indiana University Board of Trustees


2034 10
For fractional numbers, the weight
are negative powers-of-ten that
decrease from left to right beginning
with 10-1 = 0.1

102 101 100 . 10-1 10-2 10-3 ..

Decimal point

dee Copyright 2000 Indiana University Board of Trustees


2034 11
Example 1
Express the decimal number 47 as a sum
of the values of each digit.

Solution:
47 = (4 X 101) + (7 X 100)
= (4 X 10) + (7 X 1)
= 40 + 7
= 47
dee Copyright 2000 Indiana University Board of Trustees
2034 12
Example 2
Express the decimal number 568.25 as a sum of the
values of each digit.

Solution:
568.25 = (5 X 102) + (6 X 101) + (8 X 100)
+ (2 X 10-1) + (5 X 10-2)
= (5 X 100) + (6 X 10) + (8 X 1)
+ (2 X 0.1) + (5 X 0.01)
= 500 + 60 + 8 + 0.2 + 0.05
= 568.25

dee Copyright 2000 Indiana University Board of Trustees


2034 13
Binary Number System (N2 )
Also called the Base 2 system
The binary number system is used to
model the series of electrical signals
computers use to represent information
0 represents the no voltage or an off state
1 represents the presence of voltage or an
on state

dee Copyright 2000 Indiana University Board of Trustees


2034 14
Binary Numbering Scale
Base 2 Number Base 10 Equivalent Power Positional Value

000 0 20 1
001 1 21 2
010 2 22 4
011 3 23 8
100 4 24 16
101 5 25 32
110 6 26 64
111 7 27 128

dee Copyright 2000 Indiana University Board of Trustees


2034 15
Decimal to Binary Conversion
(N10 N2 )

The easiest way to convert a decimal number to


its binary equivalent is to use the Division
Algorithm
This method repeatedly divides a decimal
number by 2 and records the quotient and
remainder
The remainder digits (a sequence of zeros and
ones) form the binary equivalent in least
significant to most significant digit sequence

dee Copyright 2000 Indiana University Board of Trustees


2034 16
Example 3
Convert the following decimal numbers to
binary:
1910 ( N10 N2 )
Solution: REMAINDER
2 19
2 9 1
2 4 1
2 2 0
2 1 0
2 0 1
1 0 0 1 1

MSB LSB
dee Copyright 2000 Indiana University Board of Trustees
2034 17
Example 4
Convert the following decimal numbers to binary:
0.312510 .(N2 N10 )
Solution: MSB LSB

. 0 1 0 1
CARRY
0.3125 X 2 = 0.625 0

0.625 X 2 = 1.25 1

0.25 X 2 = 0.50 0

0.50 X 2 = 1.00 1

dee Copyright 2000 Indiana University Board of Trustees


2034 18
Binary to Decimal Conversion
The easiest method for converting a
binary number to its decimal
equivalent is to use the Multiplication
Algorithm
Multiply the binary digits by increasing
powers of two, starting from the right
Then, to find the decimal number
equivalent, sum those products
dee Copyright 2000 Indiana University Board of Trustees
2034 19
Example 5
Determine the decimal value of the binary whole number
11011012. (N2 N10 )

Solution:
Weight: 26 25 24 23 22 21 20
Binary number : 1 1 0 1 1 0 1

1101101 = 26 + 25 + 23 + 22 + 20
= 64 + 32 + 8 + 4 + 1
= 109

dee Copyright 2000 Indiana University Board of Trustees


2034 20
Example 6
Determine the decimal value of the binary whole number
0.10112.
(N2 N10 )

Solution:
Weight: 2-1 2-2 2-3 2-4
Binary number : 0. 1 0 1 1

0.1011 = 2-1 + 2-3 + 2-4


= 0.5 + 0.125 + 0.0625
= 0.6875

dee Copyright 2000 Indiana University Board of Trustees


2034 21
Octal Number System (N8 )
Also known as the Base 8 System
Uses digits (0,1,2,3,4,5,6, 7)
Readily converts to binary
Groups of three (binary) digits can be
used to represent each octal digit
Also uses multiplication and division
algorithms for conversion to and from
base 10
dee Copyright 2000 Indiana University Board of Trustees
2034 22
Octal to Binary Conversion
(N8 N2 )
Each octal number converts to 3 binary digits

To convert 6538 to binary, just


substitute code:

6 5 3

110 101 011

dee Copyright 2000 Indiana University Board of Trustees


2034 23
Binary to Octal Conversion
(N2 N8 )
3 binary digit converts to 1 octal numbers

To convert 1101010112 to octal, just


substitute code:

110 101 011

6 5 3

dee Copyright 2000 Indiana University Board of Trustees


2034 24
Substitution Code
Substitution code can also be used to
convert binary to octal by using 3-bit
groupings:
2 5 5 2 7 1 5 2

010 101 101 010 111 001 101 010

dee Copyright 2000 Indiana University Board of Trustees


2034 25
Decimal to Octal Conversion
(N10 N8 )
Convert the decimal numbers to octal:
Solution: REMAINDER
8 359 = 44.875 0.875 X 8 = 7

8 44 = 5.5 0.5 X 8 = 4

8 5 = 0.625 0.625 X 8 = 5

Stop when whole number Octal number 547


quotient is zero.

359 = 5478
dee Copyright 2000 Indiana University Board of Trustees
2034 26
Octal to Decimal Conversion
(N8 N10 )
Determine the decimal value of the octal whole number 23748.
(N8 N10 )

Solution:
Weight: 83 82 81 80
Binary number : 2 3 7 4

23748 = ( 2 X 83 ) + ( 3 X 82 ) + ( 7 X 81 ) + ( 4 X 80 )
= ( 2 X 512 ) + ( 3 X 64 ) + ( 7 X 8 ) + ( 4 X 1 )
= 1024 + 192 + 56 + 4
= 127610

dee Copyright 2000 Indiana University Board of Trustees


2034 27
Hexadecimal Number System (N16 )
Base 16 system
Uses digits 0-9 &
letters A,B,C,D,E,F
Groups of four bits
represent each
base 16 digit
dee Copyright 2000 Indiana University Board of Trustees
2034 28
Decimal to Hexadecimal Conversion
(N10 N16 )
Convert the decimal numbers to hexadecimal:
650 (N10 N16 )
Solution: REMAINDER
16 650 = 40.625 0.625 X 16 = A

16 40 = 2.5 0.5 X 16 = 8

16 2 = 0.125 0.125 X 16 = 2

Stop when whole number hexadecimal number


28A
quotient is zero.

650 = 28A16
dee Copyright 2000 Indiana University Board of Trustees
2034 29
Hexadecimal to Decimal Conversion
(N16 N10 )
Determine the decimal value of the hexadecimal whole
number E516.

Solution: (N16 N10 )


Weight: 161 160
Binary number : E 5

E516 = ( E X 161 ) + ( 5 X 160 )


= ( 14 X 16 ) + ( 5 X 1 )
= 224 + 5
= 22910

dee Copyright 2000 Indiana University Board of Trustees


2034 30
Binary to Hexadecimal Conversion
(N16 N10 )

The easiest method for converting


binary to hexadecimal is to use a
substitution code
Each hex number converts to 4 binary
digits

dee Copyright 2000 Indiana University Board of Trustees


2034 31
Substitution Code
Convert 0101011010101110011010102 to hex
using the 4-bit substitution code :
(N2 N16 )
5 6 A E 6 A

0101 0110 1010 1110 0110 1010


56AE6A16

dee Copyright 2000 Indiana University Board of Trustees


2034 32
Binary Addition
4 Possible Binary Addition Combinations:
(1) 0 (2) 0
+0 +1
Note that leading
00 01 zeroes are frequently
Carry Sum
(3) 1 (4) 1 dropped.

+0 +1
01 10

dee Copyright 2000 Indiana University Board of Trustees


2034 33
Illustrated the following addition of
11 + 1 =
Carry Carry
1 1
0 1 1
+ 0 0 1
1 0 0

dee Copyright 2000 Indiana University Board of Trustees


2034 34
Positive and Negative numbers
Several methods can be used :-
Positive only i.e. unsigned
E.g an 8 bit binary number can represent 28 or 256 different binary
patterns or numbers. Range 00000000 (010) to 11111111(25510)
What is the range of values for 16-bit values?
Positive & negative
Use most significant bit :-
0 indicates a positive number
1 indicates a negative number
The remaining bits hold the value
This method makes arithmetic very difficult!
1s Complement
Negative numbers are the complement (0 -> 1, 1 -> 0) of the
positive value. 7
dee Copyright 2000 Indiana University Board of Trustees
2034 35
Complementary Arithmetic
1s complement
Switch all 0s to 1s and 1s to 0s

Binary # 10110011
1s complement 01001100

dee Copyright 2000 Indiana University Board of Trustees


2034 36
Complementary Arithmetic
2s complement
Step 1: Find 1s complement of the
number
Binary # 11000110
1s complement 00111001
Step 2: Add 1 to the 1s complement
00111001
+ 00000001
dee 2034
00111010
Copyright 2000 Indiana University Board of Trustees 37
Representation of negative numbers

- Singed-magnitude system: the number consists


of magnitude and symbol. The MSB is for the sign
0 means positive &1 means negative

- There are two representation for 0, 1000 (-0) &


0000 (+0).

- For n-bit integer the range is (2n-1 1) to +(2n-1-1)

+18 = 00010010
-18 = 10010010

dee Copyright 2000 Indiana University Board of Trustees


2034 38
- One complement : The MSB is for the sign.

- Boolean complement all bits to negative


+18 = 00010010
-18 = 11101101

- Two representations of zero: 0000 (+0)


1111 (-0)

- The range is (2n-1 1) to +(2n-1-1).

dee Copyright 2000 Indiana University Board of Trustees


2034 39
- Twos complement: MSB is for the sign.

- The range is (2n-1) to (2n-1-1).

- 3 = 00000011
Boolean complement gives 11111100
Add 1 to LSB +1
11111101

dee Copyright 2000 Indiana University Board of Trustees


2034 40
- Only one representation for 0.

0= 00000000
Bitwise not 11111111
Add 1 to LSB +1
Result 1 00000000

Overflow is ignored, so:


-0=0

dee Copyright 2000 Indiana University Board of Trustees


2034 41
Two Complement in addition
- Twos Complement Addition

Overflow: An addition overflows if the


signs of the addends are the same and the
sign of the sum is different from
the addends sign.

dee Copyright 2000 Indiana University Board of Trustees


2034 42
1001 1100
+ 0101 + 0100
1110 = -2 10000 = 0
(a) (-7) + (+5) (b) (-4) + (+4)

0011 1100
+ 0100 + 1111
0111 = 7 11011 = -5
(c) (+3) + (+4) (d) (-4) + (-1)

dee Copyright 2000 Indiana University Board of Trustees


2034 43
0101 1001
+ 0100 + 1010
1001 = Overflow 0011 = Overflow
(e) (+5) + (+4) (f) (-7) + (-6)

dee Copyright 2000 Indiana University Board of Trustees


2034 44
Two Complement in Subtraction

Subtraction rules:

Perform a bit-by-bit complement of the


subtrahend and add the complemented subtrahend to
the minuend with an initial carry in of 1 instead of 0.

dee Copyright 2000 Indiana University Board of Trustees


2034 45
0010 0101
+ 1001 + 1110
1011 = -5 10011 = 3

(a) M = 2 = 0010 (b) M = 5 = 0101


S = 7 = 0111 S = 2 = 0010
-S = 1001 -S = 1110

dee Copyright 2000 Indiana University Board of Trustees


2034 46
1011 0101
+ 1110 + 0010
11001 = -7 0111 = 7

(c) M = -5 = 1011 (d) M = 5 = 0101


S = 2 = 0010 S = -2 = 1110
-S = 1110 -S = 0010

dee Copyright 2000 Indiana University Board of Trustees


2034 47
0111 1010
+ 0111 + 1100
1110 = Overflow 10110 = Overflow

(e) M = 7 = 0111 (f) M = -6 = 1010


S = -7 = 1001 S = 4 = 0100
-S = 0111 -S = 1100

dee Copyright 2000 Indiana University Board of Trustees


2034 48
BCD 8421
- Binary Coded Decimal (BCD) is another way
to present decimal numbers in binary form.

- BCD is widely used and combines features of


both decimal and binary systems.

- Each digit of a decimal is represented by its


four-bit binary equivalent (1 to 9)

- To represent the decimal number 10 we need


eight bits (0001 0000)

dee Copyright 2000 Indiana University Board of Trustees


2034 49
To convert the number 87410 to BCD

8 7 4 (decimal)

1000 0111 0100 (BCD)

Each digit always uses four bits.


The BCD value can never be greater than 9
Reverse the process to convert BCD to decimal.

dee Copyright 2000 Indiana University Board of Trustees


2034 50
BCD is not a number system.

BCD is a decimal number with each digit encoded


to its binary equivalent.

A BCD number is not the same as a straight binary


number.

The primary advantage of BCD is the relative


ease of converting to and from decimal.

dee Copyright 2000 Indiana University Board of Trustees


2034 51
Decimal Binary Octal Hexadecimal BCD
0 0 0 0 0
1 1 1 1 0001
2 10 2 2 0010
3 11 3 3 0011
4 100 4 4 0100
5 101 5 5 0101
6 110 6 6 0110
7 111 7 7 0111
8 1000 10 8 1000
9 1001 11 9 1001
10 1010 12 A 0001 0000
11 1011 13 B 0001 0001
12 1100 14 C 0001 0010
13 1101 15 D 0001 0011
14 1110 16 E 0001 0100
15 1111 17 F 0001 0101
dee Copyright 2000 Indiana University Board of Trustees
2034 52
ASCII Code
ASCII code is computer languages for naming letters
The ASCII name for a is 61

- It is a seven bit code. It has 27 possible code groups.

Represents characters and functions found on a


computer keyboard.

- Examples of use are: to transfer information


between computers, between computers and printers
and for internal storage.

dee Copyright 2000 Indiana University Board of Trustees


2034 53
ASCII Reference Table
Control , Numeric, Alphabetic, Punctuations Codes
MSD
0 1 2 3 4 5 6 7
LSB
0 NUL DLE SP 0 @ P p
1 SOH DC1 ! 1 A Q a W
2 STX DC2 2 B R b r
3 ETX DC3 # 3 C S c s
4 EOT DC4 $ 4 D T d t
5 ENQ NAK % 5 E U e u
6 ACJ SYN & 6 F V f v
7 BEL ETB 7 G W g w
8 BS CAN ( 8 H X h x
9 HT EM ) 9 I Y i y
A LF SUB * : J Z j z
B VT ESC + ; K [ k {

C FF FS , < L \ l |
D CR GS - = M ] m }
E SO RS . > N ^ n ~
F SI US / ? O _ o DEL

54 Copyright
dee 2034 2000 Indiana University Board of Trustees
SUMMARY

N2

N10

N8 N16

55 Copyright
dee 2034 2000 Indiana University Board of Trustees
EXERCISE 1
Convert to its DECIMAL equivalent:-

a) 1011.012 g) 76.3458 m) ABD16


b) 1011012 h) 1658 n) 1011.ACD16
c) 0.1012 i) 76.758 o) 345A.8916

d) 1111012 j) 576.458 p) 1A01916


e) 110012 k) 3218 q) 0.AFE16

f) 100.1012 l) 0.6748 r) 78.DEF6

56 Copyright
dee 2034 2000 Indiana University Board of Trustees
EXERCISE 2
Convert to its HEXDECIMAL, BCD 8421
AND ASCII equivalent:-

a) 1011.010112 g) 765.3458 m) 67510


b) 1011011102 h) 1658 n) 87610
c) 0.101102 i) 76.7548 o) 7810

d) 1111012 j) 576.458 p) 0.9810


e) 110012 k) 3218 q) 765.90810

f) 100.1010112 l) 0.67548 r) 86.5610

57 Copyright
dee 2034 2000 Indiana University Board of Trustees
EXERCISE 3
Use the 2's- complement to solve problem

a) +4510 - 8710 f) -910 - 5610

b) +710 + 3410 g) +710 + 4310

c) -6710 - 910 h) -4310 + 610

d) -2310 -[+ 7810 ] i) +1510 - 810

e) +4510 - 1010 j) +810 -[- 910 ]

58 Copyright
dee 2034 2000 Indiana University Board of Trustees
QUIZ 1
Question 1: -2 Marks
Convert 1000110110112 to its DECIMAL equivalent.

Question 2: -6 Marks
Write the next four numbers in this HEX counting
sequence:
i . 38, 39, 3A, 3B, 3C, 3D, 3E, _______, _______,
_______, ______(1M)
ii. E8A, E8B, E8C, E8D, ______, _______, _______,
_______(1M)
iii. Convert 42310 to HEX (4)

59 Copyright
dee 2034 2000 Indiana University Board of Trustees
QUIZ 1
Question 3(6 marks)
Assume the 2's- complement system for both questions
3.i and 3.ii:
i. Consider the Addition of +7 and -7. Express the
sum as a signed binary number and as a decimal
number -3 Marks
ii. Perform the Subtraction on the following pairs of
signed numbers using the 2's complement system.
Express the results as signed binary numbers and as
decimal values.
01001 - 11010 = ? -3 Marks

60 Copyright
dee 2034 2000 Indiana University Board of Trustees
QUIZ 1
Question 4 :- 6 Marks
i. Convert 0110100000111001 (BCD Code 8421) to
its decimal equivalent -2 Marks
ii. Comparison of BCD and Binary.
Represent the Decimal Value of 17810 by its
straight Binary equivalent and BCD codes
Equivalent.

7810 = _______________( Binary) -2 Marks


17810 = _______________( BCD code) -2 Marks

61 Copyright
dee 2034 2000 Indiana University Board of Trustees

You might also like