100% found this document useful (1 vote)
138 views36 pages

BCT 2206 Lecture 1 - Introduction & Number Systems DIGITAL ELECTRONICS

This document provides an introduction to digital electronics and number systems. It discusses how digital electronics deals with digital signals and logic. Number systems like binary, octal, decimal, and hexadecimal are then explained. Conversion methods between these systems are outlined, including how to represent positive and negative numbers. Advantages of digital systems over analog are noted. The document provides detailed information on number representation and conversion in digital electronics.

Uploaded by

gikurujoseph53
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
138 views36 pages

BCT 2206 Lecture 1 - Introduction & Number Systems DIGITAL ELECTRONICS

This document provides an introduction to digital electronics and number systems. It discusses how digital electronics deals with digital signals and logic. Number systems like binary, octal, decimal, and hexadecimal are then explained. Conversion methods between these systems are outlined, including how to represent positive and negative numbers. Advantages of digital systems over analog are noted. The document provides detailed information on number representation and conversion in digital electronics.

Uploaded by

gikurujoseph53
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

DIGITAL ELECTRONICS

 CHAPTER ONE: *Introduction


*Number Systems and Codes

By J. Mathenge

1 BCT 2206_DIGITAL ELECTRONICS


Chapter One: Introduction
Definition
 Digital Electronics is a sub-branch of electronics that deals with
digital signals for processing and controlling various systems and
sub-systems.
 Digital Logic involves the representation of signals and
sequences of a digital circuit through numbers. It is the basis for
digital computing and provides a fundamental understanding on
how circuits and hardware communicate within a computer.
 Digital logic is embedded into most electronic devices, e.g.
computers, video games, watches, calculators etc.

2 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
1.1 Introduction
 Digital quantities only take on discrete values while analog
quantities vary over a continuous range of values.
+5 +5
1 0 1
V V
Time Time

–5 –5

 A digital system is a combination of devices designed to


manipulate physical quantities that are represented in digital
form. e.g. digital calculators
 Analog systems manipulate systems which are represented in
analog form. e.g. pointer systems
3 BCT 2206_DIGITAL ELECTRONICS
1 NUMBER SYSTEMS AND CODES
Advantages of digital systems over analog systems.
 They are easier to design than analog systems.
 Easy to store large quantities of information.
 Accuracy and precision are greater
 digital circuits are less affected by noise.
1.2 Number Systems
 Number systems are based on an ordered set of numbers called
digits.
 Total number of digits used in a system is called the base or
radix.

4 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
 Value of each digit in a number can be determined using:
i. The value of the digit.
ii. The position of the digit in the number.
iii. Base of the number system.
 Example base 10 (or radix 10) uses ten digits 0, 1, 2, 3, 4, 5, 6,
7, 8 and 9.
1.3 Decimal System
 Is the number system that we use in our day-to-day life is the
decimal number system.
 This is a positional-value system, that is, the value of a digit
depends on its position in the number.

5 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
 There are four number systems in digital systems:
i. Decimal - Used in everyday calculations
ii. Binary - Used in all digital systems, including digital
computers
iii. Octal
iv. Hexadecimal - used along with octal systems as shorthand
notation for the Binary number system.
Number System Digits Used
Binary Number System 0,1
Octal Number System 0,1,2,3,4,5,6,7
Hexadecimal 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

6 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
1.4 Binary System
 This is known as Base 2 or Radix 2. Uses only two digits, 0
and 1.
 1.4.1 Binary to Decimal Conversion

Weighting factors

 Example: Convert 1010.101ଶ


Ans = 10.625ଵ଴

7 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
1.4.2 Decimal to Binary Conversion
 Done by successive division by 2 until you get zero (Whole
numbers)
e.g. Convert 53.8125ଵ଴ to binary.
Step 1: Start with whole number: 53. Read from
bottom to top

Ans. = 110101ଶ

8 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
Step 2: Perform successive multiplication with 2 for
fractions/decimals. Read from top to bottom
0.8125ଵ଴ to binary.

9 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
1.5 Octal System

Weighting factors

Is a base 8 system that uses digits 0-7.


1.5.1 Octal to Decimal Conversion
e.g. Convert 125.36଼ to decimal.

10 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
1.5.2 Decimal to Octal Conversion
 Step 1: Done by successive division by 8 until you get zero
(Whole numbers). Read from top to bottom.
e.g. Convert 459ଵ଴ to octal.

11 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
 Followed by successive multiplication by 8 for
fractions/decimals. Read from top to bottom.
 Example: Convert decimal number 0.78125 to octal:

1.5.3 Octal to Binary Conversion


 Convert each octal digit to its 3-bit binary equivalent.

12 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES

Example: Convert 713.62଼ to


binary.
Ans: 111001011.110010ଶ .

13 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
1.5.4 Binary to Octal conversion
 Divide the binary number in groups of 3 bits, starting from
the binary point. Example:

14 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
1.6 Hexadecimal Number System
 The hexadecimal number system uses 16 digits, 0, 1, 2, 3, 4,
5, 6, 7, 8, 9, A, B, C, D, E and F.

Weighting factors.

1.6.1 Hexadecimal to Decimal Conversion


 Example: Convert 2‫ܣܧ‬. ‫ܤ‬ଵ଺ to decimal.

15 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
1.6.2 Decimal to Hexadecimal Conversion
 Example: Convert 428.75390625ଵ଴ to hexadecimal.
 Involves successive division by 16 for whole numbers…

Followed by
successful
multiplication
by 16 for
fractions.
16 BCT 2206_DIGITAL ELECTRONICS
1 NUMBER SYSTEMS AND CODES
1.6.3 Hexadecimal to Binary Conversion
 We convert each hexadecimal digit into 4-bit binary.
Example: Convert
2‫ܣܧ‬. ‫ܤ‬ଵ଺ =
001011101010.1011ଶ

17 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
1.6.4 Binary to Hexadecimal Conversion
 Divide the binary number in groups of 4 bits, starting from
the binary point. Example:
110110011.01011ଶ

18 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
1.7 Signed Binary Numbers
 Assumed so far we were dealing with positive numbers.
 These binary numbers we have dealt with are known as
unsigned binary numbers.
 Digital systems represent all information with binary digits.
 Digital computers and calculators handle negative as well as
positive numbers. We need a way to represent the signs (+ or
-).
 There are 3 notations of signed numbers: In all +ve numbers
have the Most
i. Sign-Magnitude Notation Significant Bit (MSB)
ii. Ones (1's) Complement Notation as zero,
while --ve numbers
iii. Twos (2's) Complement Notation have an MSB of 1.

19 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
1.7.1 Sign-Magnitude Notation
 Obtain its unsigned binary equivalent using the methods
described previously.
 If positive add a zero (0) to become the MSB.
 If negative add a zero (1) to become the MSB.
 Example:
Express +53 and -53 in sign magnitude notation.
Ans:
Unsigned 53 to binary code= 110101
+53 = 0110101
-53 = 1110101

20 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
 Example: A table showing 4 bit binary numbers expressed
using sign magnitude notation.

Note: There are two


distinct patterns for
zero, a positive zero
and a negative zero.
Hence this notation not
commonly used in
arithmetic operations.

21 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
1.7.2 Ones Complement Notation (OCN)
 Get binary equivalent of the unsigned number.
53 to binary code= 110101
 Add a 0 to the number as the MSB to get its positive signed
equivalent.
+53 = 0110101
(This is the OCN for the positive number)
 To get the negative version of the number, change each zero
in the formed positive binary number to a 1, and each one to
a 0 (get the complement).
-53 = 1001010
22 BCT 2206_DIGITAL ELECTRONICS
1 NUMBER SYSTEMS AND CODES
Table showing OCN binary numbers vs their
Decimal Equivalents.
Note: Again there are two distinct
patterns for zero, a positive zero and
a negative zero.

23 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
 Illustrating the problem created by the two patterns for zero:
 Suppose we are performing the operation:
7−4
 This is similar to writing
7 + (−4)
 From the previous table, +7=0111 and −4=1011. If we add
the two binary numbers we get:
10010
 Since this was a 4 bit operation we ignore the fifth bit to get
0010 which corresponds to +2. But we all know 7 − 4 = 3.
This is occasioned by having two zeros.

24 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
1.7.3 Twos Complement Notation (TCN)
 Get binary equivalent of the unsigned number.
53 to binary code= 110101
 Add a 0 to the number as the MSB to get its positive signed
equivalent.
+53 = 0110101
(This is the OCN and TCN for the positive number)
 To get the OCN version negative number, change each zero in the
formed positive binary number to a 1, and each one to a 0 (get the
complement).
-53 = 1001010
 To get the TCN add one to the LSB position of the OCN:
-53 = 1001011

25 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
• In this case, there is only one
zero, so there are no
problems with arithmetic.

26 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
 Illustrating that the problem is now resolved:
 Suppose we are performing the operation:
7−4
 This is similar to writing
7 + (−4)
 From the previous table, +7=0111 and −4=1100. If we add
the two binary numbers we get:
10011
 Since this was a 4 bit operation we ignore the fifth bit to get
0011 which corresponds to +3.

27 BCT 2206_DIGITAL ELECTRONICS


Example:
 Convert -29.625 into Twos Complement Binary.
Solution:
Get the binary equivalent of 29.265 (unsigned)

Get the positive equivalent of the number +29.265 (Add a


zero)
Get the complement of the positive number to get the OCN of
the negative number:

Get the TCN of the negative number:

28 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
 Note: In the previous example, -29.625 is represented using
9 bits. If we wanted to represent it using 16 bits then we
have:

 After obtaining the unsigned binary, we add leading zeros and


a `0‘ sign-bit to make total to 16 bits.

29 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
1.8 Binary Number Codes
 Are binary codes which have special applications.
1.8.1 Binary Coded Decimal (BCD) code
BCD code represents each digit of a decimal number by a 4-bit
binary.

30 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
 Note that BCD code uses binary codes 0000 to 1001 to
represent decimal digits. Does not use codes 1010, 1011,
1100, 1101, 1110 and 1111.
Example:
 Convert the decimal number 137 to BCD.
Solution:
 Write out the BCD code for each digit to get:
1 is 0001, for 3 is 0011 and for 7 is 0111 hence 000100110111.
N/B: To convert a BCD code number to decimal, we simply group the
bits in groups of 4bits each from the LSB side and write out the decimal
digits corresponding to each group.
31 BCT 2206_DIGITAL ELECTRONICS
1 NUMBER SYSTEMS AND CODES
Advantages of BCD:
 Relative ease of converting to and from decimal.
Disadvantages:
 It requires more storage space.
 The arithmetic with BCD is more complicated.
1.8.2 Excess-3 code (Xs-3 code)
 A 3 is added to each decimal digit before encoding it in
binary.
 Example: Convert 59 to Xs-3 code

32 BCT 2206_DIGITAL ELECTRONICS


1 NUMBER SYSTEMS AND CODES
Solution:

Note: The Xs-3


code does not use
codes 0000,
0001, 0010,
1101, 1110 and
1111.
ADVANTAGE:
One is present in all
Xs3 codes, providing
an error-detection
ability.
33 BCT 2206_DIGITAL ELECTRONICS
1 NUMBER SYSTEMS AND CODES
1.8.3 Gray Code
*Read on Gray Code and its advantages. To recap in the next
class.

34 BCT 2206_DIGITAL ELECTRONICS


*End of session*

35 BCT 2206_DIGITAL ELECTRONICS


Questions….?

36 BCT 2206_DIGITAL ELECTRONICS

You might also like