SlideShare a Scribd company logo
1 of 93
DEE20033 : DIGITAL ELECTRONICS
References:
"Digital Systems Principles And Application"
Sixth Edition, Ronald J. Tocci.
"Digital Systems Fundamentals"
P.W Chandana Prasad, Lau Siong Hoe,
Dr. Ashutosh Kumar Singh, Muhammad Suryanata.
CHAPTER 1:
NUMBER SYSTEMS AND CODES
sabariah@psas.edu.my sabariahsalihin@gmail.com
Programme Learning Outcomes, PLO
Upon completion of the programmed, graduates should be able to:
 PLO 1 : Apply knowledge of applied mathematics, applied science,
engineering fundamentals an engineering specialisations as specified in
DK1 to DK4 respectively to wide practical procedures and practices;
Course Learning Outcomes, CLO
Upon completion of the course, students should be able to:
 CLO 1 : Apply the knowledge of logic operations using Boolean Algebra
or Karnaugh Map in Digital Logic circuits
CHAPTER 1:
NUMBER SYSTEMS AND CODES
DEE20033 DIGITAL ELECTRONICS
Upon completion of this Chapter, students should be able to:
 Remember the following number systems :decimal, binary,
octal and Hexadecimal and BCD 8421 codes convert the
numbers from ne system to another.
 Understand Binary, Octal and Hexadecimal Number
System.
 Apply arithmetic operation using number systems
 Apply binary codes used in computers representing decimal
digits, alphanumeric characters and symbols.
CHAPTER 1:
NUMBER AND
CODE SYSTEMS
DEE20033 DIGITAL ELECTRONICS
1.1INTRODUCTION
 Many number system are in use in digital
technology. The Most common are the decimal,
binary, octal and hexadecimal system.
 The Binary number system is the most important
one in digital systems.
 The Decimal System is the most familiar because it is
universally used to represent quantities outside a
digital system and it is a tool that we use every day.
DEE20033 DIGITAL ELECTRONICS
 This means that there will be situations where
decimal values have to be converted to binary values
before they are entered into the digital system.
 For example, when you punch a decimal number into
your hand calculator(or computer), the circuitry
inside the device converts the decimal number to a
binary value.
1.1 INTRODUCTION
DEE20033 DIGITAL ELECTRONICS
 Likewise, there will be situations where the binary values
at the outputs of a digital circuit have to be converted to
decimal values for presentation to the outside world.
 For example, your calculator (or computer) uses binary
numbers to calculate answers to a prolem, then converts
the answers to a decimal value before displaying them.
 The octal (base-8) and hexadecimal (based-16) number
systems are both used for the same purpose-to provide
an efficient means for representing large binary
numbers.
1.1 INTRODUCTION
DEE20033 DIGITAL ELECTRONICS
 An understanding of the system operation requires
the ability to convert from one number system to
another.
 This chapter will show you how to perform these
conversions .
 This chapter will also introduce some of the binary
codes that are used to represent various kinds of
information.
 These binary codes will used 1’s and 0’s .
1.1 INTRODUCTION
DEE20033 DIGITAL ELECTRONICS
1.1.1 Decimal Number System
 The Decimal System is composed of 10 numerals or
symbols.
 These 10 symbols are 0,1,2,3,4,5,6,7,8,9 : using these
symbols as digits of a number, we can express any
quantity.
 The decimal system, also called the base-10 system
because it has 10 digits, has evolved naturally as a
result of the fact that man has 10 fingers.
 In fact, the word “digit” is derived from the Latin
word for “Finger”.
DEE20033 DIGITAL ELECTRONICS
 The decimal system is a positional-value system in
which the value of a digit depends on its position.
 For example: consider the decimal number 453.
 Digit 4 actually represents 4 hundreds, the 5
represent 5 tens, and the 3 represent 3 units.
 In essence, the 4 carries the most weight of the three
digits; it is referred to as the most significant digit
(MSD).
 The 3 carries the least weight and is called the least
significant digit (LSD).
1.1.1 Decimal Number System
DEE20033 DIGITAL ELECTRONICS
 Consider another example, 27. 35
 This number is actually equal to 2 tens plus 7 units
plus 3 tenth plus 5 hndredths or 2 x 10 + 7 x 1 + 3 x
0.1 + 5 x 0.01
 The decimal point is used to separate the integer and
fractional parts of the number.
1.1.1 Decimal Number System
DEE20033 DIGITAL ELECTRONICS
 Moreover, the various positions relative to the
decimal point carry weights that can be expressed as
powers of 10.
 Example : 2745.214
10
3
10
2
10
1
10
0
10
-1
10
-2
10
-3
1.1.1 Decimal Number System
2 7 4 5 . 2 1 4
MSD LSDDecimal Point
= (2x 10
3
)+(7x 10
2
)+(4x 10
1
)+(5x 10
0
)+(2x 10
-1
)+(1x 10
-2
)+(4x 10
-3
)
Figure 1 : Decimal position values as power of 10
DEE20033 DIGITAL ELECTRONICS
 In general any number is simply the sum of products
of each digit value and its positional value.
 Unfortunately, Decimal number system does not
lend itself to convinient implementation in digital
system.
 It is very difficult to design electronics equipment so
that it can work with 10 different voltage levels (0-9).
 For this reason, almost every digital system uses the
binary number system base-2 as the basic number to
design electronics circuits that operate with only two
voltage levels.
1.1.1 Decimal Number System
DEE2034 DIGITAL ELECTRONICS
 In binary system, there are only two symbols or
possible digit values, 0 and 1.
 Even so, this base-2 system can be used to represent
any quantity that can be represented in decimal or
other number systems.
 All the statements made ealier concering the decimal
system are equally applicable to the binary system.
 The binary system is also a positional-value system,
where in each binary digit has its own value or
weight expressed as a power of 2.
1.1.2 Binary Number System
DEE20033 DIGITAL ELECTRONICS
 Example:
• Here,places to the left of the binary point (counterpart of the
decimal point) are positive power of 2 and places to the right are
negative power of 2.
 Exercise : Find the equivalent in the decimal system for the
number 1011.1012
Answer : 11.62510 (How?)
1.1.2 Binary Number System
1 0 1 1 . 1 0 1
MSB LSB
Binary Point
2
3
2
2
2
1
2
0
2
-1
2
-2
2
-3
Figure 2 : Binary position values as power of 2
DEE20033 DIGITAL ELECTRONICS
 In the binary system, the term binary digit is often
abbreviated to the term bit, which we will use
henceforth.
1.1.2 Binary Number System
DEE20033 DIGITAL ELECTRONICS
1.1.2 Binary Number System
EE202 SEMICONDUCTOR DEVICES
Figure 3 : Binary Counting Sequence
= 8 = 4 = 2 = 1 Decimal
equivalent
0
0
0
0
0
0
0
0
0
0
1
1
0
1
0
1
0
1
2
3
0
0
0
0
1
1
1
1
0
0
1
1
0
1
0
1
4
5
6
7
1
1
1
1
0
0
0
0
0
0
1
1
0
1
0
1
8
9
10
11
1
1
1
1
1
1
1
1
0
0
1
1
0
1
0
1
12
13
14
15
2
3
2
2
2
1
2
0Weights
LSB
 Example:
What is the largest number that can be represented using
8 bits?
 Solution :
2
N
- 1 = 2
8
-1
= 25510
= 111111112
1.1.2 Binary Number System
DEE20033 DIGITAL ELECTRONICS
 Review Questions:
1. What is the decimal equivalent of 11010112?
2.What is the next binary number following 101112 in
the counting sequence?
3.What is the largest decimal value that can be
represented using 12 bits?
1.1.2 Binary Number System
DEE20033 DIGITAL ELECTRONICS
 A Binary number can be converted to decimal by
multiplying the weight of each position with the binary digit
and adding together.
 Example :
Convert the Binary number 101102 to its Decimal equivalent.
 Solution:
Binary number 1 0 1 1 02
2
4
+ 2
3
+ 2
2
+ 2
1
+ 2
0
(2
4
x 1)+(2
3
x 0)+(2
2
x 1)+(2
1
x 1)+(2
0
x 0 )
= 16 + 0 + 4 + 2 + 0
= 2210
1.1.3 Binary to Decimal Conversion
DEE20033 DIGITAL ELECTRONICS
 Example :
Convert the Fractional Binary Number 101.102 to its
Decimal equivalent.
 Solution:
Binary Number = 1 0 1 . 1 0
Power of 2 position = 2
2
2
1
2
0
. 2
-1
2
-2
= (2
2
x 1)+(2
1
x 0)+(2
0
x 1) . (2
-1
x 1)+(2
-2
x 0 )
Decimal Value = 4 + 0 + 1 . 0.5 + 0
= 5.5 10
1.1.3 Binary to Decimal Conversion
DEE20033 DIGITAL ELECTRONICS
1.1.3 Binary to Decimal Conversion
DEE20033 DIGITAL ELECTRONICS
1.1.3 Decimal To Binary conversion
 The most convenient method is called division by 2
method.
 In which first decimal number will be divided by 2.
 The quotient will be dividend for the next step. In each step
the remainder part will be recorded separately.
 The 1st reminder of the 1st division will be the LSB in the
Binary Number.
 The quotient should repeatedly divide by 2 until the
quotient becomes 0.
 The final remainder will be the MSB in Binary number.
DEE20033 DIGITAL ELECTRONICS
 Example :
Convert Decimal 2010 to its Binary equivalent.
Solution:
2 20 remainder of 0
2 10 remainder of 0
2 5 remainder of 1
2 2 remainder of 0
2 1 remainder 0f 1
0
1 0 1 0 02
1.1.3 Decimal To Binary conversion
DEE20033 DIGITAL ELECTRONICS
 When converting a decimal fractional number to its
binary, the decimal fractional part will be multiply by
2 till the fractional part gets 0 or till the number of
decimal places reached.
1.1.3 Decimal To Binary conversion
DEE20033 DIGITAL ELECTRONICS
 Below example show the steps to convert decimal fraction
0.625 to its binary equivalent.
Step 1 : 0.625 will be multiply by 2 ( 0.625 x 2 = 1.25)
Step 2 : The integer part will be the MSB in the binary
result
Step 3 : The fractional part of the earlier result will be
multiply again ( 0.25 x 2 = 0.5 )
Step 4 : Each time after the multiplication the integer part of
the result will be written as the Binary number.
Step 5 : The procedure should continue till the fractional part
gets 0.
1.1.3 Decimal To Binary conversion
DEE20033 DIGITAL ELECTRONICS
 Example :
Convert Decimal 0.62510 to its binary equivalent.
Solution:
0.25 x 2 = 0.50
0. 5 x 2 = 1. 00 LSB
carried MSB 1 0 1
= 0.62510 = . 1012
1.1.3 Decimal To Binary conversion
DEE20033 DIGITAL ELECTRONICS
 Example :
Convert Decimal 3610 to its Binary equivalent.
Solution:
2 36 remainder of 0
2 18 remainder of 0
2 9 remainder of 1
2 4 remainder of 0
2 2 remainder 0f 0
2 1 remainder 0f 1
0
1 0 0 1 0 02
Review Questions:
DEE20033 DIGITAL ELECTRONICS
1.1.4 Binary Addition
 Adding of two binary numbers follows same as addition of
two decimal numbers.
 Some times binary addition is very much easier then
Decimal or any other number system addition, because in
binary you deal with only 2 numbers.
 There are mainly 4 rules should be followed in the process
of addition in binary numbers:
sum carryout
Rule 1 : 0 + 0 = 0 0
Rule 2 : 0 + 1 = 1 1
Rule 3 : 1 + 0 = 1 1
Rule 4 : 1 + 1 = 0 1
DEE20033 DIGITAL ELECTRONICS
Example:
Perform Binary Addition for 1012 + 0102
Solution:
1 0 12
0 1 02 +
1 1 1
Exercise:
Perform Binary Addition for 10112 + 01112
Answer: 10 01 02
1.1.4 Binary Addition
DEE20033 DIGITAL ELECTRONICS
 When subtracting one binary number A
(subtrahend) from another binary number B
(Minuend) where B > A, the answer is called the
difference.
 There are four basic rules that should be followed in
binary subtracting To perform Rule 2 you have to
borrow 1 from the next left column.
 The weight of the binary you borrow will be 2.
1.1.5 Binary Subtraction
DEE20033 DIGITAL ELECTRONICS
 Minuend (B) Subtrahend (A) Difference Borrow out
 Rule 1 0 - 0 = 0
 Rule 2 0 - 1 = 1 with a borrow of 1
 Rule 3 1 - 0 = 1
 Rule 4 1 - 1 = 0
Example:
Subtract binary 1012 from 1102
0
1 1 0
1 0 1
0 0 1 = 0012
1.1.5 Binary Subtraction
DEE20033 DIGITAL ELECTRONICS
1.1.6 Signed Binary Numbers
 A signed number consist both positive and negative
sign with magnitude.
 The additional bit for representing the sign of the
number (+ or -) is known as sign bit.
 in general, 0 in the sign bit represents a positive
number and 1 in the sign bit represents a negative
number.
 The leftmost bit 0 is the sign bit represent +
 The leftmost bit 1 is the sign bit represent -
DEE20033 DIGITAL ELECTRONICS
 Therefore the stored number in register A and B is 13
and -13 respectively in Decimal form.
 The signed bit is used to indicate the positive or
negative nature of the stored binary numbers.
 Here the magnitude bits are the binary equivalent of
the decimal value being represented.
 This is called the sign magnitude system.
1.1.6 Signed Binary Numbers
DEE20033 DIGITAL ELECTRONICS
1.1.6 Signed Binary Numbers
 Sign bit (+) A4 A3 A2 A1 A 0
= +13
B4 B3 B2 B1 B0
= - 13
Representing Signed Number
0 1 1 0 1
1 1 1 0 1
DEE20033 DIGITAL ELECTRONICS
Example:
 Express the Decimal number -46 in 8 bit Signed
magnitude system
Solution:
True Binary number for +46
= 00101110
Change the sign bit to 1 and remain unchanged
magnitude nits
= 10101110 = -46
1.1.6 Signed Binary Numbers
DEE20033 DIGITAL ELECTRONICS
1.2 Octal Number System
 Octal number has eight possible symbols: 0 , 1 , 2 , 3 ,
4 , 5 , 6 , 7 and used to express binary numbers,
which is called as base of 8 number system or Radix
of 8.
 Figure: illustrated how it decrease with negative
power of 8:
8
5
8
4
8
3
8
2
8
1
8
0
. 8
-1
8
-2
8
-3
8
-4
8
-5
Decrease with negative power of 8
DEE20033 DIGITAL ELECTRONICS
1.2.2 Octal to Binary Conversion
 Any octal number can be represent by 3 bit binary
number, such as 0002 to represent 08 and 111 2 to
represent 78
Example:
Convert 4358 to its Binary equivalent.
Solution:
4 3 58
100 011 101 = 1000111012
DEE20033 DIGITAL ELECTRONICS
 Exercise:
Convert 54.78 to its Binary equivalent.
Solution :
5 4 . 78
101 100 . 111 = 101100.1112
1.2.2 Octal to Binary Conversion
DEE20033 DIGITAL ELECTRONICS
1.2.1 Binary to Octal Conversion
 This is the reverse form of the octal to binary conversion.
 First, the Binary number should be divided into group of
three from LSB.
 Then each three-bit binary number is converted to an Octal
form.
Example:
Convert 1001010112 to its equivalent Octal number.
Solution:
100 101 011
4 5 3 = 4 5 38
DEE20033 DIGITAL ELECTRONICS
 Sometimes the Binary numberwill not have even groups of
3 bits.
 For those cases, we can add one or two 0s to the left of the
MSB of the binary number to fill out the last group.
Example:
Convert 110101102 to its equivalent Octal number.
Solution:
011 010 110
3 2 68 =3268
NOTE that a 0 was placed to the left of the MSB to produce even groups of 3 Bits.
1.2.1 Binary to Octal Conversion
DEE20033 DIGITAL ELECTRONICS
 Octal number can be converted to decimal by multiplying
the weight of each position with the octal number and
adding together.
 Example:
Convert the Octal number 2578 to its decimal equivalent
 Solution:
2578 = (2 x 8
2
)+ (5 x 8
1
)+ (7 x 8
0
)
= (2 x 64) + (5 x 8) + (7 x 1)
= 17510
1.2.2 Octal Number to Decimal Conversion
DEE20033 DIGITAL ELECTRONICS
 Exercise :
Convert the Octal number 17.78 to its Decimal
equivalent
Solution:
17.78 = (1 x 8
1
) + (7 x 80) + (7 x 8
-1
)
= (1 x 8) + (7 x 1) + (7 x .125)
= 15.87510
1.2.2 Octal Number to Decimal Conversion
DEE20033 DIGITAL ELECTRONICS
 Here we can apply the same method done in decimal to
binary conversion. Dividing the decimal number by 8 can
do conversion to octal.
Example :
Convert 9710 to its Octal equivalent.
Solution :
8 97 + remainder of 1
8 12 + remainder of 4
8 1 + remainder of 1
0
1 4 18
1.2.2 Decimal to Octal Conversion
DEE20033 DIGITAL ELECTRONICS
Review Question:
1. Convert 6148 to decimal.
2. Convert 14610 to Octal, then from Octal to Binary.
3. Convert 100111012 to Octal.
4. Convert 97510 to Binary by First Coverting to Octal.
5. Convert Binary 10101110112 to Decimal by first converting
to Octal.
Answer:
1. 396 2. 222, 010010010 3. 235
4. 1111001111 5. 699
DEE20033 DIGITAL ELECTRONICS
1.3 Hexadecimal Number System
 Hexadecimal number system is called as base 16
number system.
 It uses 10 decimal numbers and 6 alphabetic
characters to represent all 16 possible symbols.
 Table below, shows Hexadecimal numbers with its
equivalent in decimal and Binary.
DEE20033 DIGITAL ELECTRONICS
Hexadecimal
Number
Binary Number Decimal Nmber
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
A 1010 10
B 1011 11
C 1100 12
D 1101 13
E 1110 14
F 1111 15
1.3 Hexadecimal Number System
DEE20033 DIGITAL ELECTRONICS
1.3.1 Hexadecimal to Binary Conversion
 Hexadecimal number can be represent in Binary form by
using 4 bits for each hexadecimal number.
016 can be written in binary = 0000
716 in binary can be written = 0111
A16 in binary can be written = 1010
Example:
Convert the Hexadecimal A516 to its Binary equivalent.
Solution : A 516
1010 01012 = 101001012
DEE20033 DIGITAL ELECTRONICS
Exercise:
Convert the Hexadecimal 9F216 to its Binary
equivalent.
Solution:
9 F 2
1001 1111 0010 = 1001111100102
1.3.1 Hexadecimal to Binary Conversion
DEE20033 DIGITAL ELECTRONICS
 This is the reverse form of the Hexadecimal to Binary
Conversion.
 First the Binary number should be Divided into
group of Four bits from LSB.
 Then each four-bit binary number is converted to a
Hexadecimal form.
1.3.1 Binary to Hexadecimal Conversion
DEE20033 DIGITAL ELECTRONICS
 Example:
Convert the Binary 10110110111110102 to its equivalent
Hexadecimal number.
Solution:
1011 0110 1111 1010
B 6 F A = B6FA16
1.3.1 Binary to Hexadecimal Conversion
DEE20033 DIGITAL ELECTRONICS
 Exercise:
Convert the Binary 11101001102 to its
equivalent Hexadecimal number.
Solution:
0011 1010 01102
3 A 6 = 3A616
1.3.1 Binary to Hexadecimal Conversion
DEE20033 DIGITAL ELECTRONICS
1.3.2 Hexadecimal to Decimal Conversion
 Hexadecimal number can be converted to decimal by
multiplying the weight of each position of the hexadecimal
number (power of 16) and adding togather.
Example:
Convert the Hexadecimal number 32716 to its Decimal
Equivalent.
Solution :
32716 = (3 x 16
2
) + (2 x 16
1
) + (7 x 16
0
)
= ( 3 x 256) + ( 2 x 16 ) + ( 7 x 1 )
= 80710
DEE20033 DIGITAL ELECTRONICS
Example :
Convert the Hexadecimal number 2AF16 to its
Decimal Equivalent.
Solution:
2AF16 = (2 x 162)+(10 x 161 )+(15 x 160 )
= (512) + (160) + (15)
= 68710
1.3.2 Hexadecimal to Decimal Conversion
DEE20033 DIGITAL ELECTRONICS
 Exercise :
Convert the Hexadecimal number 1BC216 to its
Decimal Equivalent.
Solution:
= (1 x 16
3
)+(11 x 16
2
)+(12 x 16
1
)+(2 x 16
0
)
= 710610
1.3.2 Hexadecimal to Decimal Conversion
DEE20033 DIGITAL ELECTRONICS
 Here we can apply the same method done in Decimal to
Binary conversion.
 Since we need to convert to Hexadecimal, so we have to
divide the Decimal number by 16.
 Example :
Convert the Decimal 38210 to its Hexadecimal
equivalent.
Solution: 16 382 + remainder of 14
16 23 + remainder of 7
0
7 E16
1.3.2 Decimal to Hexadecimal Conversion
DEE20033 DIGITAL ELECTRONICS
Counting Hexadecimal
 When counting in Hex, each digit position can be
incremented (increased by 1) from 0 to F.
 Once a digit position reaches, the value F, it is
RESET to 0 and the next digit position is
incremented.
 This illustrated in the following Hex counting
sequences.
(a). 38, 39, 3A, 3B, 3C, 3D, 3E, 3F, 40, 41, 42
(b). 6F8, 6F9, 6FA, 6FB, 6FC, 6FD, 6FE, 6FF, 700
DEE20033 DIGITAL ELECTRONICS
Review Question:
1. Convert 24CE16 to Decimal.
2. Convert 311710 to Hex, then from Hex to Binary.
3. Convert 10010111101101012 to Hex.
4. Write the next four numbers in this Hex counting
sequence. E9A, E9B, E9C, E9D, ___,___,___,___
5. Convert 35278 to Hex.
Answer:
1. 9422 2. C2D ; 110000101101 3. 97B5
4. E9E, E9F, EA0, EA1 5. 757
DEE20033 DIGITAL ELECTRONICS
1.4 Gray odes
• Gray code – also known as Cyclic Code, Reflected Binary Code
(RBC), Reflected Binary (RB) or Grey code – is defined as an
ordering of the binary number system such that each incremental value
can only differ by one bit.
• In gray code, while traversing from one step to another step only one
bit in the code group changes. That is to say that two adjacent code
numbers differ from each other by only one bit.
• Gray code is the most popular of the unit distance codes, but it is not
suitable for arithmetic operations. Gray code has some applications in
analog to digital converters, as well as being used for error correction in
digital communication.
• Gray code can be difficult to understand initially, but becomes much
easier to understand when looking at the gray code tables below.
DEE20033 DIGITAL ELECTRONICS
1.4 Gray odes
• Gray code is a form of binary encoding where transitions
between consecutive numbers differ by only one bit.
• This is a useful encoding for reducing hardware data
hazards with values that change rapidly and/or connect to
slower hardware as inputs.
• It is also useful for generating inputs for Karnaugh maps in
order from left to right or top to bottom. Create functions
to encode a number to and decode a number from Gray
code.
• Display the normal binary representations, Gray code
representations, and decoded Gray code values for all 5-bit
binary numbers (0-31 inclusive, leading 0's not necessary).
DEE20033 DIGITAL ELECTRONICS
1.4 Gray Code Table
DEE20033 DIGITAL ELECTRONICS
1.4.1 Binary to Gray Code Converter
• The logical circuit which
converts the binary code to
equivalent Gray code is known
as binary to Gray code
converter.
• An n-bit Gray code can be
obtained by reflecting an n-1 bit
code about an axis after 2n-1
rows and putting the MSB
(Most Significant Bit) of 0
above the axis and the MSB of 1
below the axis.
The 4 bit binary to gray code
conversion table is given below:
DEE20033 DIGITAL ELECTRONICS
1.4.1 How to Convert Binary to Gray Code
1. The MSB (Most Significant Bit) of the gray code will be exactly equal to the
first bit of the given binary number.
2. The second bit of the code will be exclusive-or (XOR) of the first and second
bit of the given binary number, i.e if both the bits are same the result will be
0 and if they are different the result will be 1.
3. The third bit of gray code will be equal to the exclusive-or (XOR) of the
second and third bit of the given binary number. Thus the binary to gray
code conversion goes on. An example is given below to illustrate these
steps
DEE20033 DIGITAL ELECTRONICS
1.4.1 Binary to Gray Code Conversion Example
Say we have a binary number 01001 which we wish to convert to gray code. Let’s
go through an example of how we would perform this conversion:
1. The MSB is kept the same. As the MSB of the binary is 0, the MSB of the gray code will
be 0 as well (first gray bit)
2. Next, take the XOR of the first and the second binary bit. The first bit is 0, and the
second bit is 1. The bits are different so the resultant gray bit will be 1 (second gray bit)
3. Next, take the XOR of the second and third binary bit. The second bit is 1, and the third
bit is 0. These bits are again different so the resultant gray bit will be 1 (third gray bit)
4. Next, take the XOR of third and fourth binary bit. The third bit is 0, and the fourth bit is
0. As these are the same, the resultant gray bit will be 0 (fourth gray bit)
DEE20033 DIGITAL ELECTRONICS
5. Lastly, take the XOR of the fourth and
fifth binary bit. The fourth bit is 0, and
the fifth bit is 1. These bits are different
so the resultant gray bit will be 1 (fifth
gray bit)
6. Hence the result of binary to gray code
conversion of 01001 is complete, and the
equivalent gray code is 01101.
1.4.1 Binary to Gray Code Conversion Example
DEE20033 DIGITAL ELECTRONICS
1.4.2 Gray to Binary Code Converter
In a gray to binary code
converter, the input is gray
code and output is its
equivalent binary code.
Let us consider a 4 bit gray to
binary code converter.
To design a 4 bit gray to binary
code converter, we first have to
draw a gray code conversion
table, as shown below:
DEE20033 DIGITAL ELECTRONICS
Logic circuit : Will continue in Chapter 2 for Boolean
DEE20033 DIGITAL ELECTRONICS
1.4.2 Gray Code to Binary Conversion
Gray code to binary conversion is again a very simple and easy process.
Following steps can make your idea clear on this type of conversions.
1.The MSB of the binary number will be equal to the MSB of the given Gray
code.
2.Now if the second Gray bit is 0, then the second binary bit will be the same
as the previous or the first bit. If the Gray bit is 1 the second binary bit will
alter. If it was 1 it will be 0 and if it was 0 it will be 1.
3. This step is continued for all the bits to do Gray code to binary
conversion.
DEE20033 DIGITAL ELECTRONICS
1.4.2 Gray Code to Binary Conversion Example
1. The MSB of the binary will be 0 as the MSB of gray is 0. Now move to
the next gray bit.
2. As it is 1 the previous binary bit will alter i.e it will be 1, thus the second
binary bit will be 1.
3. Next look at the third bit of the gray code.
4. It is again 1 thus the previous bit i.e the second binary bit will again
alter and the third bit of the binary number will be 0.
5. Now, the 4th bit of the given gray is 0 so the previous binary bit will be
unchanged, i.e 4th binary bit will be 0.
6. Now again the 5th grey bit is 1 thus the previous binary bit will alter, it
will be 1 from 0.
7. Therefore the equivalent binary number in case of gray code to the
binary conversion will be (01001).
DEE20033 DIGITAL ELECTRONICS
1.5.1 1's Complement Form
 The 1's complement form of any binary number is
simply obtained by taking the complement form of 0
and 1.
 1 to 0 and 0 to 1
* The range is –(2n-1 – 1) to +(2n-1-1).
Example:
Find the 1's complement 101001
Solution: 1 0 1 0 0 1 Binary Number
0 1 0 1 1 0 1's complement of Binary Number
DEE20033 DIGITAL ELECTRONICS
 The 2's complement form of binary number is
obtained by taking the complement form of 0, 1 and
adding 1 to LSB.
 The range is –(2n-1) to (2n-1-1).
Example:
Find the 2's complement of 1110010
Solution:
1 1 1 0 0 1 0 Binary Number
0 0 0 1 1 0 1 1's complement
+ 1 Add 1
0 0 0 1 1 1 0 2's complement
1.5.2 2's Complement Form
DEE20033 DIGITAL ELECTRONICS
1.5.3 Signed Number Representing Using
2's Complement
Example:
Express the Decimal number -25 in the 2's complement
system using 8-bits.
Solution:
Represent the +25 in Binary for
0 0 0 1 1 0 0 1
1 1 1 0 0 1 1 0 ( 1's complement)
+1
1 1 1 0 0 1 1 1 ( 2's complement)
DEE20033 DIGITAL ELECTRONICS
1.5.3 2's complement Addition
 The two number in addition are addend and augend which
result in the sum.
 The following five cases can be occur when two binary
numbers are added;
CASE 1: Both number are positive
Straight Foward addition.
Example: +8 and +4 in 5 bits
0 1000 ( + 8, augend)
0 0100 ( + 4, addend)
0 1 1 0 0 ( sum = + 12)
signed bit
DEE20033 DIGITAL ELECTRONICS
 CASE 2: Positive number larger than negative
number
Example:
Add two numbers +17 and -6 in six bits
Solution:
0 1 0 0 0 1 (+17)
1 1 1 0 1 0 (-6)
1 0 0 1 0 1 1 (+11)
The Final carry bit is disregarded
1.5.3 2's complement Addition
DEE20033 DIGITAL ELECTRONICS
 CASE 3: Positive number smaller than negative
number
 Example:
 Add two numbers -8 and +4
Solution:
1 1 0 0 0 ( -8, augend)
0 0 1 0 0 ( +4, addend)
1 1 1 0 0 ( sum = -4)
sign bit
1.5.3 2's complement Addition
Since the SUM is negative,
it is in 2's complement form.
DEE20033 DIGITAL ELECTRONICS
 Case 4: Both numbers are negative
Example:
Add two numbers -5 and -9 in 8 bits.
Solution:
1 1 1 1 1 0 1 1 (-5)
+ 1 1 1 1 0 1 1 1 (-9)
1 1 1 1 1 0 0 1 0 (-14)
The final carry bit is disregarded
1.5.3 2's complement Addition
Since the SUM is negative,
it is in 2's complement form.
DEE20033 DIGITAL ELECTRONICS
 when subtracting the binary number ( the subtrahend) from
another binary number ( the minuend) then change the sign
of the subtrahend and adds it to the minuend.
Case 1: Both numbers are positive :
Example:
Subtract +41 from +75 in byte.
Solution: Minuend ( +75) = 01001011
Subtrahend (+41)=00101001
Take the 2's complement form of subtrahend (+41) and add
with miuend.
1.5.3 2's complement Subtraction
DEE20033 DIGITAL ELECTRONICS
0 1 0 0 1 0 1 1 (+75)
1 1 0 1 0 1 1 1 (-41)
1 0 0 1 0 0 0 1 0 (+34)
discard
1.5.3 2's complement Subtraction
DEE20033 DIGITAL ELECTRONICS
 CASE 2: Both numbers are negative
Example:
Subtract -30 from -80 in 8bit.
Solution:
In this case (-80) - (-30) = ( -80) + (30)
1 0 1 1 0 0 0 0 (-80)
- 0 0 0 1 1 1 1 0 (+30)
1 1 0 0 1 1 1 0 (-50)
1.3.3 2's complement Subtraction
DEE20033 DIGITAL ELECTRONICS
 CASE 3 :
Both numbers are opposite sign
Example:
Subtract -20 from + 24 in byte.
Solution:
In this case (+24) - (-20) = (+24)+(20)
0 0 0 1 1 0 0 0(+24)
0 0 0 1 0 1 0 0 (+20)
0 0 1 0 1 1 0 0 (+44)
1.3.3 2's complement Subtraction
DEE20033 DIGITAL ELECTRONICS
1.5 How Binary CODES are Used in Computers
 Binary codes are used in computers representing
Decimal digits, alphanumeric characters and
symbols.
 When Numbers, letters or words are represented by
a speacial group of symbols, we say that they are
being encoded, and the group of symbols is called a
code.
 When a decimal number is represented by its
equivalent binary number, we call it Straight
Binary Coding.
DEE20033 DIGITAL ELECTRONICS
 BCD- Binary Coded Decimal Code
 If each digit of a decimal number is represented by
its binary equivalent, the result is a code called
Binary Coded Decimal , BCD.
 To illustrate the BCD code, take a Decimal number
such as 874.
 Each digit is changed to its Binary Equivalent as
follows :
8 7 4 (Decimal)
1000 0111 0100 (BCD)
1.5.1 BCD 8421 codes
DEE20033 DIGITAL ELECTRONICS
 As another example, let us change 943 to its BCD-
code representation:
9 4 3 (Decimal)
1001 0100 0011 ( BCD)
 Once again, each decimal digit is changed to its
straight Binary equivalent.
 Note that 4 Bits are always used for each digit.
 The BCD code, then represents each digit of the
decimal number by a 4 Bit binary number.
1.5.1 BCD 8421 codes
DEE20033 DIGITAL ELECTRONICS
 Clearly only the 4-bit binary numbers from 0000
through 1001 are used.
 The BCD code does not use the numbers 1010,
1011, 1100, 1101, 1110 and 1111.
 In other words, only 10 of the 16 possible 4-bit
binary code groups are used.
 If any of the "forbidden" 4-bit numbers ever occurs
in a machine using the BCD code, it is usually an
indication that an error has occurred.
1.5.1 BCD 8421 codes
DEE20033 DIGITAL ELECTRONICS
Example:
Convert 0110100000111001 (BCD) to its decimal
equivalent.
Solution:
Divide the BCD number into 4-bit groups and convert
each to decimal.
0110 1000 0011 1001
6 8 3 9
1.5.1 BCD 8421 codes
DEE20033 DIGITAL ELECTRONICS
Exercise:
Convert the BCD number 011111000001 to its Decimal
equivalent.
Solution:
0111 1100 0001
7 1
Forbidden code group indicates error in
BCD number
1.5.1 BCD 8421 codes
DEE20033 DIGITAL ELECTRONICS
1.5.1 Comparison of BCD and Binary
 It is important to realize that BCD is not another number
system like binary, octal, decimal and Hexadecimal.
 It is also important to understand that a BCD number is not
the same as a straight binary number.
 A straight binary code takes the complete decimal number
and represents it in binary.
 BCD code converts each decimal digit to binary
individually.
 Example:
13710 = 100010012 (binary)
13710 = 0001 0011 0111 (BCD)
DEE20033 DIGITAL ELECTRONICS
1.5.2 Alphanumeric Codes
 A computer should recognize codes that represent
letters of the alphabet, puntuation marks, and
other special characters as well as numbers.
 A complete alphanumeric code would include the
26 lowercase latters, 26 uppercase latter, 10
numeric digits, 7 punctuation marks, and
anywhere from 20 to 40 other characters such as +
/ * # and so on.
 we can say that an alphanumeric code represents
all of the various characters and functions that are
found on a standard typewriter or computer
keyboard.
DEE20033 DIGITAL ELECTRONICS
 The most widely used alphanumeric code.
 American Standard Code for Information
interchange (ASCII).
 Pronounced "askee"
Refer table next slide to see :
Partial Listing of ASCII code.
1.5.2 Alphanumeric Codes - ASCII Code
DEE20033 DIGITAL ELECTRONICS
ASCII Reference Table
DEE20033 DIGITAL ELECTRONICS
Extended ASCII Codes
DEE20033 DIGITAL ELECTRONICS
Example:
The following is a message encoded in ASCII code.
What is the message?
1001000 1000101 1001100 1010000
Solution:
Convert each 7-bit code to its Hexadecimal equivalent.
The results are : 48 45 4C 50
Now, locate these Hexadecimal values in table ASCII and
determine the character represented by each. The results are:
H E L P
1.5.2 Alphanumeric Codes - ASCII Code
DEE20033 DIGITAL ELECTRONICS
References
 "Digital Systems Principles And Application"
Sixth Editon, Ronald J. Tocci.
 "Digital Systems Fundamentals"
P.W Chandana Prasad, Lau Siong Hoe,
Dr. Ashutosh Kumar Singh, Muhammad Suryanata.
sabariah@psas.edu.my sabariahsalihin@gmail.com
The End Of Chapter 1...
 Do Review Questions
 Do Tutorial Questions
sabariah@psas.edu.my sabariahsalihin@gmail.com

More Related Content

What's hot (20)

Number System
Number SystemNumber System
Number System
 
Number system
Number systemNumber system
Number system
 
Binary codes
Binary codesBinary codes
Binary codes
 
Chapter 1 digital systems and binary numbers
Chapter 1 digital systems and binary numbersChapter 1 digital systems and binary numbers
Chapter 1 digital systems and binary numbers
 
Number system
Number systemNumber system
Number system
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital Electronics
 
Introduction to binary number system
Introduction to binary number systemIntroduction to binary number system
Introduction to binary number system
 
digital logic design number system
digital logic design number systemdigital logic design number system
digital logic design number system
 
Number Systems Basic Concepts
Number Systems Basic ConceptsNumber Systems Basic Concepts
Number Systems Basic Concepts
 
Digital Logic & Design
Digital Logic & DesignDigital Logic & Design
Digital Logic & Design
 
Multiplexer and De-Multiplexer
Multiplexer and De-MultiplexerMultiplexer and De-Multiplexer
Multiplexer and De-Multiplexer
 
Boolean algebra and Logic gates
Boolean algebra and Logic gatesBoolean algebra and Logic gates
Boolean algebra and Logic gates
 
Searching algorithms
Searching algorithmsSearching algorithms
Searching algorithms
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
 
Half Adder & Full Adder
Half Adder & Full AdderHalf Adder & Full Adder
Half Adder & Full Adder
 
Pertemuan ke-1 sistem digital
Pertemuan ke-1 sistem digitalPertemuan ke-1 sistem digital
Pertemuan ke-1 sistem digital
 
Digital Logic Design
Digital Logic Design Digital Logic Design
Digital Logic Design
 
Chapter 2: Boolean Algebra and Logic Gates
Chapter 2: Boolean Algebra and Logic GatesChapter 2: Boolean Algebra and Logic Gates
Chapter 2: Boolean Algebra and Logic Gates
 
Boolean algebra
Boolean algebraBoolean algebra
Boolean algebra
 
Binary Arithmetic Operations
Binary Arithmetic OperationsBinary Arithmetic Operations
Binary Arithmetic Operations
 

Similar to Chapter 1 number and code system sss

Ee 202 chapter 1 number and code system
Ee 202 chapter 1 number and code system Ee 202 chapter 1 number and code system
Ee 202 chapter 1 number and code system CT Sabariah Salihin
 
Dee 2034 chapter 1 number and code system (Baia)
Dee 2034 chapter 1 number and code system (Baia)Dee 2034 chapter 1 number and code system (Baia)
Dee 2034 chapter 1 number and code system (Baia)SITI SABARIAH SALIHIN
 
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...Arti Parab Academics
 
Module 1 number systems and code1
Module 1  number systems and code1Module 1  number systems and code1
Module 1 number systems and code1Deepak John
 
Data repersentation.
Data repersentation.Data repersentation.
Data repersentation.Ritesh Saini
 
Physics investigatory project for class 12 logic gates
Physics investigatory project for class 12 logic gatesPhysics investigatory project for class 12 logic gates
Physics investigatory project for class 12 logic gatesbiswanath dehuri
 
Digital Electronics & Fundamental of Microprocessor-I
Digital Electronics & Fundamental of Microprocessor-IDigital Electronics & Fundamental of Microprocessor-I
Digital Electronics & Fundamental of Microprocessor-Ipravinwj
 
1.Digital Electronics overview & Number Systems.pptx
1.Digital Electronics overview & Number Systems.pptx1.Digital Electronics overview & Number Systems.pptx
1.Digital Electronics overview & Number Systems.pptxLibanMohamed26
 
Number_systems_for _o_& _A_levels by fari
Number_systems_for _o_& _A_levels by fariNumber_systems_for _o_& _A_levels by fari
Number_systems_for _o_& _A_levels by fariFari84
 
Computer Oraganizaation.pptx
Computer Oraganizaation.pptxComputer Oraganizaation.pptx
Computer Oraganizaation.pptxbmangesh
 

Similar to Chapter 1 number and code system sss (20)

Ee 202 chapter 1 number and code system
Ee 202 chapter 1 number and code system Ee 202 chapter 1 number and code system
Ee 202 chapter 1 number and code system
 
Dee 2034 chapter 1 number and code system (Baia)
Dee 2034 chapter 1 number and code system (Baia)Dee 2034 chapter 1 number and code system (Baia)
Dee 2034 chapter 1 number and code system (Baia)
 
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
FYBSC IT Digital Electronics Unit I Chapter I Number System and Binary Arithm...
 
Module 1 number systems and code1
Module 1  number systems and code1Module 1  number systems and code1
Module 1 number systems and code1
 
DCF QNA edited
DCF QNA editedDCF QNA edited
DCF QNA edited
 
Data repersentation.
Data repersentation.Data repersentation.
Data repersentation.
 
Physics investigatory project for class 12 logic gates
Physics investigatory project for class 12 logic gatesPhysics investigatory project for class 12 logic gates
Physics investigatory project for class 12 logic gates
 
Number System
Number SystemNumber System
Number System
 
Digital Electronics
Digital ElectronicsDigital Electronics
Digital Electronics
 
Digital Electronics & Fundamental of Microprocessor-I
Digital Electronics & Fundamental of Microprocessor-IDigital Electronics & Fundamental of Microprocessor-I
Digital Electronics & Fundamental of Microprocessor-I
 
DLD-Introduction.pptx
DLD-Introduction.pptxDLD-Introduction.pptx
DLD-Introduction.pptx
 
chap1.pdf
chap1.pdfchap1.pdf
chap1.pdf
 
chap1.pdf
chap1.pdfchap1.pdf
chap1.pdf
 
chap1.pdf
chap1.pdfchap1.pdf
chap1.pdf
 
computer Unit 2
computer Unit 2computer Unit 2
computer Unit 2
 
1.Digital Electronics overview & Number Systems.pptx
1.Digital Electronics overview & Number Systems.pptx1.Digital Electronics overview & Number Systems.pptx
1.Digital Electronics overview & Number Systems.pptx
 
Number_systems_for _o_& _A_levels by fari
Number_systems_for _o_& _A_levels by fariNumber_systems_for _o_& _A_levels by fari
Number_systems_for _o_& _A_levels by fari
 
Module 4
Module 4Module 4
Module 4
 
Computer Oraganizaation.pptx
Computer Oraganizaation.pptxComputer Oraganizaation.pptx
Computer Oraganizaation.pptx
 
Unit-1.pptx
Unit-1.pptxUnit-1.pptx
Unit-1.pptx
 

Recently uploaded

HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17Celine George
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningMarc Dusseiller Dusjagr
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesSHIVANANDaRV
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxakanksha16arora
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use CasesTechSoup
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxCeline George
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 

Recently uploaded (20)

HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food Additives
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use Cases
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 

Chapter 1 number and code system sss

  • 1. DEE20033 : DIGITAL ELECTRONICS References: "Digital Systems Principles And Application" Sixth Edition, Ronald J. Tocci. "Digital Systems Fundamentals" P.W Chandana Prasad, Lau Siong Hoe, Dr. Ashutosh Kumar Singh, Muhammad Suryanata. CHAPTER 1: NUMBER SYSTEMS AND CODES sabariah@psas.edu.my sabariahsalihin@gmail.com
  • 2. Programme Learning Outcomes, PLO Upon completion of the programmed, graduates should be able to:  PLO 1 : Apply knowledge of applied mathematics, applied science, engineering fundamentals an engineering specialisations as specified in DK1 to DK4 respectively to wide practical procedures and practices; Course Learning Outcomes, CLO Upon completion of the course, students should be able to:  CLO 1 : Apply the knowledge of logic operations using Boolean Algebra or Karnaugh Map in Digital Logic circuits CHAPTER 1: NUMBER SYSTEMS AND CODES DEE20033 DIGITAL ELECTRONICS
  • 3. Upon completion of this Chapter, students should be able to:  Remember the following number systems :decimal, binary, octal and Hexadecimal and BCD 8421 codes convert the numbers from ne system to another.  Understand Binary, Octal and Hexadecimal Number System.  Apply arithmetic operation using number systems  Apply binary codes used in computers representing decimal digits, alphanumeric characters and symbols. CHAPTER 1: NUMBER AND CODE SYSTEMS DEE20033 DIGITAL ELECTRONICS
  • 4. 1.1INTRODUCTION  Many number system are in use in digital technology. The Most common are the decimal, binary, octal and hexadecimal system.  The Binary number system is the most important one in digital systems.  The Decimal System is the most familiar because it is universally used to represent quantities outside a digital system and it is a tool that we use every day. DEE20033 DIGITAL ELECTRONICS
  • 5.  This means that there will be situations where decimal values have to be converted to binary values before they are entered into the digital system.  For example, when you punch a decimal number into your hand calculator(or computer), the circuitry inside the device converts the decimal number to a binary value. 1.1 INTRODUCTION DEE20033 DIGITAL ELECTRONICS
  • 6.  Likewise, there will be situations where the binary values at the outputs of a digital circuit have to be converted to decimal values for presentation to the outside world.  For example, your calculator (or computer) uses binary numbers to calculate answers to a prolem, then converts the answers to a decimal value before displaying them.  The octal (base-8) and hexadecimal (based-16) number systems are both used for the same purpose-to provide an efficient means for representing large binary numbers. 1.1 INTRODUCTION DEE20033 DIGITAL ELECTRONICS
  • 7.  An understanding of the system operation requires the ability to convert from one number system to another.  This chapter will show you how to perform these conversions .  This chapter will also introduce some of the binary codes that are used to represent various kinds of information.  These binary codes will used 1’s and 0’s . 1.1 INTRODUCTION DEE20033 DIGITAL ELECTRONICS
  • 8. 1.1.1 Decimal Number System  The Decimal System is composed of 10 numerals or symbols.  These 10 symbols are 0,1,2,3,4,5,6,7,8,9 : using these symbols as digits of a number, we can express any quantity.  The decimal system, also called the base-10 system because it has 10 digits, has evolved naturally as a result of the fact that man has 10 fingers.  In fact, the word “digit” is derived from the Latin word for “Finger”. DEE20033 DIGITAL ELECTRONICS
  • 9.  The decimal system is a positional-value system in which the value of a digit depends on its position.  For example: consider the decimal number 453.  Digit 4 actually represents 4 hundreds, the 5 represent 5 tens, and the 3 represent 3 units.  In essence, the 4 carries the most weight of the three digits; it is referred to as the most significant digit (MSD).  The 3 carries the least weight and is called the least significant digit (LSD). 1.1.1 Decimal Number System DEE20033 DIGITAL ELECTRONICS
  • 10.  Consider another example, 27. 35  This number is actually equal to 2 tens plus 7 units plus 3 tenth plus 5 hndredths or 2 x 10 + 7 x 1 + 3 x 0.1 + 5 x 0.01  The decimal point is used to separate the integer and fractional parts of the number. 1.1.1 Decimal Number System DEE20033 DIGITAL ELECTRONICS
  • 11.  Moreover, the various positions relative to the decimal point carry weights that can be expressed as powers of 10.  Example : 2745.214 10 3 10 2 10 1 10 0 10 -1 10 -2 10 -3 1.1.1 Decimal Number System 2 7 4 5 . 2 1 4 MSD LSDDecimal Point = (2x 10 3 )+(7x 10 2 )+(4x 10 1 )+(5x 10 0 )+(2x 10 -1 )+(1x 10 -2 )+(4x 10 -3 ) Figure 1 : Decimal position values as power of 10 DEE20033 DIGITAL ELECTRONICS
  • 12.  In general any number is simply the sum of products of each digit value and its positional value.  Unfortunately, Decimal number system does not lend itself to convinient implementation in digital system.  It is very difficult to design electronics equipment so that it can work with 10 different voltage levels (0-9).  For this reason, almost every digital system uses the binary number system base-2 as the basic number to design electronics circuits that operate with only two voltage levels. 1.1.1 Decimal Number System DEE2034 DIGITAL ELECTRONICS
  • 13.  In binary system, there are only two symbols or possible digit values, 0 and 1.  Even so, this base-2 system can be used to represent any quantity that can be represented in decimal or other number systems.  All the statements made ealier concering the decimal system are equally applicable to the binary system.  The binary system is also a positional-value system, where in each binary digit has its own value or weight expressed as a power of 2. 1.1.2 Binary Number System DEE20033 DIGITAL ELECTRONICS
  • 14.  Example: • Here,places to the left of the binary point (counterpart of the decimal point) are positive power of 2 and places to the right are negative power of 2.  Exercise : Find the equivalent in the decimal system for the number 1011.1012 Answer : 11.62510 (How?) 1.1.2 Binary Number System 1 0 1 1 . 1 0 1 MSB LSB Binary Point 2 3 2 2 2 1 2 0 2 -1 2 -2 2 -3 Figure 2 : Binary position values as power of 2 DEE20033 DIGITAL ELECTRONICS
  • 15.  In the binary system, the term binary digit is often abbreviated to the term bit, which we will use henceforth. 1.1.2 Binary Number System DEE20033 DIGITAL ELECTRONICS
  • 16. 1.1.2 Binary Number System EE202 SEMICONDUCTOR DEVICES Figure 3 : Binary Counting Sequence = 8 = 4 = 2 = 1 Decimal equivalent 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 0 1 2 3 0 0 0 0 1 1 1 1 0 0 1 1 0 1 0 1 4 5 6 7 1 1 1 1 0 0 0 0 0 0 1 1 0 1 0 1 8 9 10 11 1 1 1 1 1 1 1 1 0 0 1 1 0 1 0 1 12 13 14 15 2 3 2 2 2 1 2 0Weights LSB
  • 17.  Example: What is the largest number that can be represented using 8 bits?  Solution : 2 N - 1 = 2 8 -1 = 25510 = 111111112 1.1.2 Binary Number System DEE20033 DIGITAL ELECTRONICS
  • 18.  Review Questions: 1. What is the decimal equivalent of 11010112? 2.What is the next binary number following 101112 in the counting sequence? 3.What is the largest decimal value that can be represented using 12 bits? 1.1.2 Binary Number System DEE20033 DIGITAL ELECTRONICS
  • 19.  A Binary number can be converted to decimal by multiplying the weight of each position with the binary digit and adding together.  Example : Convert the Binary number 101102 to its Decimal equivalent.  Solution: Binary number 1 0 1 1 02 2 4 + 2 3 + 2 2 + 2 1 + 2 0 (2 4 x 1)+(2 3 x 0)+(2 2 x 1)+(2 1 x 1)+(2 0 x 0 ) = 16 + 0 + 4 + 2 + 0 = 2210 1.1.3 Binary to Decimal Conversion DEE20033 DIGITAL ELECTRONICS
  • 20.  Example : Convert the Fractional Binary Number 101.102 to its Decimal equivalent.  Solution: Binary Number = 1 0 1 . 1 0 Power of 2 position = 2 2 2 1 2 0 . 2 -1 2 -2 = (2 2 x 1)+(2 1 x 0)+(2 0 x 1) . (2 -1 x 1)+(2 -2 x 0 ) Decimal Value = 4 + 0 + 1 . 0.5 + 0 = 5.5 10 1.1.3 Binary to Decimal Conversion DEE20033 DIGITAL ELECTRONICS
  • 21. 1.1.3 Binary to Decimal Conversion DEE20033 DIGITAL ELECTRONICS
  • 22. 1.1.3 Decimal To Binary conversion  The most convenient method is called division by 2 method.  In which first decimal number will be divided by 2.  The quotient will be dividend for the next step. In each step the remainder part will be recorded separately.  The 1st reminder of the 1st division will be the LSB in the Binary Number.  The quotient should repeatedly divide by 2 until the quotient becomes 0.  The final remainder will be the MSB in Binary number. DEE20033 DIGITAL ELECTRONICS
  • 23.  Example : Convert Decimal 2010 to its Binary equivalent. Solution: 2 20 remainder of 0 2 10 remainder of 0 2 5 remainder of 1 2 2 remainder of 0 2 1 remainder 0f 1 0 1 0 1 0 02 1.1.3 Decimal To Binary conversion DEE20033 DIGITAL ELECTRONICS
  • 24.  When converting a decimal fractional number to its binary, the decimal fractional part will be multiply by 2 till the fractional part gets 0 or till the number of decimal places reached. 1.1.3 Decimal To Binary conversion DEE20033 DIGITAL ELECTRONICS
  • 25.  Below example show the steps to convert decimal fraction 0.625 to its binary equivalent. Step 1 : 0.625 will be multiply by 2 ( 0.625 x 2 = 1.25) Step 2 : The integer part will be the MSB in the binary result Step 3 : The fractional part of the earlier result will be multiply again ( 0.25 x 2 = 0.5 ) Step 4 : Each time after the multiplication the integer part of the result will be written as the Binary number. Step 5 : The procedure should continue till the fractional part gets 0. 1.1.3 Decimal To Binary conversion DEE20033 DIGITAL ELECTRONICS
  • 26.  Example : Convert Decimal 0.62510 to its binary equivalent. Solution: 0.25 x 2 = 0.50 0. 5 x 2 = 1. 00 LSB carried MSB 1 0 1 = 0.62510 = . 1012 1.1.3 Decimal To Binary conversion DEE20033 DIGITAL ELECTRONICS
  • 27.  Example : Convert Decimal 3610 to its Binary equivalent. Solution: 2 36 remainder of 0 2 18 remainder of 0 2 9 remainder of 1 2 4 remainder of 0 2 2 remainder 0f 0 2 1 remainder 0f 1 0 1 0 0 1 0 02 Review Questions: DEE20033 DIGITAL ELECTRONICS
  • 28. 1.1.4 Binary Addition  Adding of two binary numbers follows same as addition of two decimal numbers.  Some times binary addition is very much easier then Decimal or any other number system addition, because in binary you deal with only 2 numbers.  There are mainly 4 rules should be followed in the process of addition in binary numbers: sum carryout Rule 1 : 0 + 0 = 0 0 Rule 2 : 0 + 1 = 1 1 Rule 3 : 1 + 0 = 1 1 Rule 4 : 1 + 1 = 0 1 DEE20033 DIGITAL ELECTRONICS
  • 29. Example: Perform Binary Addition for 1012 + 0102 Solution: 1 0 12 0 1 02 + 1 1 1 Exercise: Perform Binary Addition for 10112 + 01112 Answer: 10 01 02 1.1.4 Binary Addition DEE20033 DIGITAL ELECTRONICS
  • 30.  When subtracting one binary number A (subtrahend) from another binary number B (Minuend) where B > A, the answer is called the difference.  There are four basic rules that should be followed in binary subtracting To perform Rule 2 you have to borrow 1 from the next left column.  The weight of the binary you borrow will be 2. 1.1.5 Binary Subtraction DEE20033 DIGITAL ELECTRONICS
  • 31.  Minuend (B) Subtrahend (A) Difference Borrow out  Rule 1 0 - 0 = 0  Rule 2 0 - 1 = 1 with a borrow of 1  Rule 3 1 - 0 = 1  Rule 4 1 - 1 = 0 Example: Subtract binary 1012 from 1102 0 1 1 0 1 0 1 0 0 1 = 0012 1.1.5 Binary Subtraction DEE20033 DIGITAL ELECTRONICS
  • 32. 1.1.6 Signed Binary Numbers  A signed number consist both positive and negative sign with magnitude.  The additional bit for representing the sign of the number (+ or -) is known as sign bit.  in general, 0 in the sign bit represents a positive number and 1 in the sign bit represents a negative number.  The leftmost bit 0 is the sign bit represent +  The leftmost bit 1 is the sign bit represent - DEE20033 DIGITAL ELECTRONICS
  • 33.  Therefore the stored number in register A and B is 13 and -13 respectively in Decimal form.  The signed bit is used to indicate the positive or negative nature of the stored binary numbers.  Here the magnitude bits are the binary equivalent of the decimal value being represented.  This is called the sign magnitude system. 1.1.6 Signed Binary Numbers DEE20033 DIGITAL ELECTRONICS
  • 34. 1.1.6 Signed Binary Numbers  Sign bit (+) A4 A3 A2 A1 A 0 = +13 B4 B3 B2 B1 B0 = - 13 Representing Signed Number 0 1 1 0 1 1 1 1 0 1 DEE20033 DIGITAL ELECTRONICS
  • 35. Example:  Express the Decimal number -46 in 8 bit Signed magnitude system Solution: True Binary number for +46 = 00101110 Change the sign bit to 1 and remain unchanged magnitude nits = 10101110 = -46 1.1.6 Signed Binary Numbers DEE20033 DIGITAL ELECTRONICS
  • 36. 1.2 Octal Number System  Octal number has eight possible symbols: 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 and used to express binary numbers, which is called as base of 8 number system or Radix of 8.  Figure: illustrated how it decrease with negative power of 8: 8 5 8 4 8 3 8 2 8 1 8 0 . 8 -1 8 -2 8 -3 8 -4 8 -5 Decrease with negative power of 8 DEE20033 DIGITAL ELECTRONICS
  • 37. 1.2.2 Octal to Binary Conversion  Any octal number can be represent by 3 bit binary number, such as 0002 to represent 08 and 111 2 to represent 78 Example: Convert 4358 to its Binary equivalent. Solution: 4 3 58 100 011 101 = 1000111012 DEE20033 DIGITAL ELECTRONICS
  • 38.  Exercise: Convert 54.78 to its Binary equivalent. Solution : 5 4 . 78 101 100 . 111 = 101100.1112 1.2.2 Octal to Binary Conversion DEE20033 DIGITAL ELECTRONICS
  • 39. 1.2.1 Binary to Octal Conversion  This is the reverse form of the octal to binary conversion.  First, the Binary number should be divided into group of three from LSB.  Then each three-bit binary number is converted to an Octal form. Example: Convert 1001010112 to its equivalent Octal number. Solution: 100 101 011 4 5 3 = 4 5 38 DEE20033 DIGITAL ELECTRONICS
  • 40.  Sometimes the Binary numberwill not have even groups of 3 bits.  For those cases, we can add one or two 0s to the left of the MSB of the binary number to fill out the last group. Example: Convert 110101102 to its equivalent Octal number. Solution: 011 010 110 3 2 68 =3268 NOTE that a 0 was placed to the left of the MSB to produce even groups of 3 Bits. 1.2.1 Binary to Octal Conversion DEE20033 DIGITAL ELECTRONICS
  • 41.  Octal number can be converted to decimal by multiplying the weight of each position with the octal number and adding together.  Example: Convert the Octal number 2578 to its decimal equivalent  Solution: 2578 = (2 x 8 2 )+ (5 x 8 1 )+ (7 x 8 0 ) = (2 x 64) + (5 x 8) + (7 x 1) = 17510 1.2.2 Octal Number to Decimal Conversion DEE20033 DIGITAL ELECTRONICS
  • 42.  Exercise : Convert the Octal number 17.78 to its Decimal equivalent Solution: 17.78 = (1 x 8 1 ) + (7 x 80) + (7 x 8 -1 ) = (1 x 8) + (7 x 1) + (7 x .125) = 15.87510 1.2.2 Octal Number to Decimal Conversion DEE20033 DIGITAL ELECTRONICS
  • 43.  Here we can apply the same method done in decimal to binary conversion. Dividing the decimal number by 8 can do conversion to octal. Example : Convert 9710 to its Octal equivalent. Solution : 8 97 + remainder of 1 8 12 + remainder of 4 8 1 + remainder of 1 0 1 4 18 1.2.2 Decimal to Octal Conversion DEE20033 DIGITAL ELECTRONICS
  • 44. Review Question: 1. Convert 6148 to decimal. 2. Convert 14610 to Octal, then from Octal to Binary. 3. Convert 100111012 to Octal. 4. Convert 97510 to Binary by First Coverting to Octal. 5. Convert Binary 10101110112 to Decimal by first converting to Octal. Answer: 1. 396 2. 222, 010010010 3. 235 4. 1111001111 5. 699 DEE20033 DIGITAL ELECTRONICS
  • 45. 1.3 Hexadecimal Number System  Hexadecimal number system is called as base 16 number system.  It uses 10 decimal numbers and 6 alphabetic characters to represent all 16 possible symbols.  Table below, shows Hexadecimal numbers with its equivalent in decimal and Binary. DEE20033 DIGITAL ELECTRONICS
  • 46. Hexadecimal Number Binary Number Decimal Nmber 0 0000 0 1 0001 1 2 0010 2 3 0011 3 4 0100 4 5 0101 5 6 0110 6 7 0111 7 8 1000 8 9 1001 9 A 1010 10 B 1011 11 C 1100 12 D 1101 13 E 1110 14 F 1111 15 1.3 Hexadecimal Number System DEE20033 DIGITAL ELECTRONICS
  • 47. 1.3.1 Hexadecimal to Binary Conversion  Hexadecimal number can be represent in Binary form by using 4 bits for each hexadecimal number. 016 can be written in binary = 0000 716 in binary can be written = 0111 A16 in binary can be written = 1010 Example: Convert the Hexadecimal A516 to its Binary equivalent. Solution : A 516 1010 01012 = 101001012 DEE20033 DIGITAL ELECTRONICS
  • 48. Exercise: Convert the Hexadecimal 9F216 to its Binary equivalent. Solution: 9 F 2 1001 1111 0010 = 1001111100102 1.3.1 Hexadecimal to Binary Conversion DEE20033 DIGITAL ELECTRONICS
  • 49.  This is the reverse form of the Hexadecimal to Binary Conversion.  First the Binary number should be Divided into group of Four bits from LSB.  Then each four-bit binary number is converted to a Hexadecimal form. 1.3.1 Binary to Hexadecimal Conversion DEE20033 DIGITAL ELECTRONICS
  • 50.  Example: Convert the Binary 10110110111110102 to its equivalent Hexadecimal number. Solution: 1011 0110 1111 1010 B 6 F A = B6FA16 1.3.1 Binary to Hexadecimal Conversion DEE20033 DIGITAL ELECTRONICS
  • 51.  Exercise: Convert the Binary 11101001102 to its equivalent Hexadecimal number. Solution: 0011 1010 01102 3 A 6 = 3A616 1.3.1 Binary to Hexadecimal Conversion DEE20033 DIGITAL ELECTRONICS
  • 52. 1.3.2 Hexadecimal to Decimal Conversion  Hexadecimal number can be converted to decimal by multiplying the weight of each position of the hexadecimal number (power of 16) and adding togather. Example: Convert the Hexadecimal number 32716 to its Decimal Equivalent. Solution : 32716 = (3 x 16 2 ) + (2 x 16 1 ) + (7 x 16 0 ) = ( 3 x 256) + ( 2 x 16 ) + ( 7 x 1 ) = 80710 DEE20033 DIGITAL ELECTRONICS
  • 53. Example : Convert the Hexadecimal number 2AF16 to its Decimal Equivalent. Solution: 2AF16 = (2 x 162)+(10 x 161 )+(15 x 160 ) = (512) + (160) + (15) = 68710 1.3.2 Hexadecimal to Decimal Conversion DEE20033 DIGITAL ELECTRONICS
  • 54.  Exercise : Convert the Hexadecimal number 1BC216 to its Decimal Equivalent. Solution: = (1 x 16 3 )+(11 x 16 2 )+(12 x 16 1 )+(2 x 16 0 ) = 710610 1.3.2 Hexadecimal to Decimal Conversion DEE20033 DIGITAL ELECTRONICS
  • 55.  Here we can apply the same method done in Decimal to Binary conversion.  Since we need to convert to Hexadecimal, so we have to divide the Decimal number by 16.  Example : Convert the Decimal 38210 to its Hexadecimal equivalent. Solution: 16 382 + remainder of 14 16 23 + remainder of 7 0 7 E16 1.3.2 Decimal to Hexadecimal Conversion DEE20033 DIGITAL ELECTRONICS
  • 56. Counting Hexadecimal  When counting in Hex, each digit position can be incremented (increased by 1) from 0 to F.  Once a digit position reaches, the value F, it is RESET to 0 and the next digit position is incremented.  This illustrated in the following Hex counting sequences. (a). 38, 39, 3A, 3B, 3C, 3D, 3E, 3F, 40, 41, 42 (b). 6F8, 6F9, 6FA, 6FB, 6FC, 6FD, 6FE, 6FF, 700 DEE20033 DIGITAL ELECTRONICS
  • 57. Review Question: 1. Convert 24CE16 to Decimal. 2. Convert 311710 to Hex, then from Hex to Binary. 3. Convert 10010111101101012 to Hex. 4. Write the next four numbers in this Hex counting sequence. E9A, E9B, E9C, E9D, ___,___,___,___ 5. Convert 35278 to Hex. Answer: 1. 9422 2. C2D ; 110000101101 3. 97B5 4. E9E, E9F, EA0, EA1 5. 757 DEE20033 DIGITAL ELECTRONICS
  • 58. 1.4 Gray odes • Gray code – also known as Cyclic Code, Reflected Binary Code (RBC), Reflected Binary (RB) or Grey code – is defined as an ordering of the binary number system such that each incremental value can only differ by one bit. • In gray code, while traversing from one step to another step only one bit in the code group changes. That is to say that two adjacent code numbers differ from each other by only one bit. • Gray code is the most popular of the unit distance codes, but it is not suitable for arithmetic operations. Gray code has some applications in analog to digital converters, as well as being used for error correction in digital communication. • Gray code can be difficult to understand initially, but becomes much easier to understand when looking at the gray code tables below. DEE20033 DIGITAL ELECTRONICS
  • 59. 1.4 Gray odes • Gray code is a form of binary encoding where transitions between consecutive numbers differ by only one bit. • This is a useful encoding for reducing hardware data hazards with values that change rapidly and/or connect to slower hardware as inputs. • It is also useful for generating inputs for Karnaugh maps in order from left to right or top to bottom. Create functions to encode a number to and decode a number from Gray code. • Display the normal binary representations, Gray code representations, and decoded Gray code values for all 5-bit binary numbers (0-31 inclusive, leading 0's not necessary). DEE20033 DIGITAL ELECTRONICS
  • 60. 1.4 Gray Code Table DEE20033 DIGITAL ELECTRONICS
  • 61. 1.4.1 Binary to Gray Code Converter • The logical circuit which converts the binary code to equivalent Gray code is known as binary to Gray code converter. • An n-bit Gray code can be obtained by reflecting an n-1 bit code about an axis after 2n-1 rows and putting the MSB (Most Significant Bit) of 0 above the axis and the MSB of 1 below the axis. The 4 bit binary to gray code conversion table is given below: DEE20033 DIGITAL ELECTRONICS
  • 62. 1.4.1 How to Convert Binary to Gray Code 1. The MSB (Most Significant Bit) of the gray code will be exactly equal to the first bit of the given binary number. 2. The second bit of the code will be exclusive-or (XOR) of the first and second bit of the given binary number, i.e if both the bits are same the result will be 0 and if they are different the result will be 1. 3. The third bit of gray code will be equal to the exclusive-or (XOR) of the second and third bit of the given binary number. Thus the binary to gray code conversion goes on. An example is given below to illustrate these steps DEE20033 DIGITAL ELECTRONICS
  • 63. 1.4.1 Binary to Gray Code Conversion Example Say we have a binary number 01001 which we wish to convert to gray code. Let’s go through an example of how we would perform this conversion: 1. The MSB is kept the same. As the MSB of the binary is 0, the MSB of the gray code will be 0 as well (first gray bit) 2. Next, take the XOR of the first and the second binary bit. The first bit is 0, and the second bit is 1. The bits are different so the resultant gray bit will be 1 (second gray bit) 3. Next, take the XOR of the second and third binary bit. The second bit is 1, and the third bit is 0. These bits are again different so the resultant gray bit will be 1 (third gray bit) 4. Next, take the XOR of third and fourth binary bit. The third bit is 0, and the fourth bit is 0. As these are the same, the resultant gray bit will be 0 (fourth gray bit) DEE20033 DIGITAL ELECTRONICS
  • 64. 5. Lastly, take the XOR of the fourth and fifth binary bit. The fourth bit is 0, and the fifth bit is 1. These bits are different so the resultant gray bit will be 1 (fifth gray bit) 6. Hence the result of binary to gray code conversion of 01001 is complete, and the equivalent gray code is 01101. 1.4.1 Binary to Gray Code Conversion Example DEE20033 DIGITAL ELECTRONICS
  • 65. 1.4.2 Gray to Binary Code Converter In a gray to binary code converter, the input is gray code and output is its equivalent binary code. Let us consider a 4 bit gray to binary code converter. To design a 4 bit gray to binary code converter, we first have to draw a gray code conversion table, as shown below: DEE20033 DIGITAL ELECTRONICS
  • 66. Logic circuit : Will continue in Chapter 2 for Boolean DEE20033 DIGITAL ELECTRONICS
  • 67. 1.4.2 Gray Code to Binary Conversion Gray code to binary conversion is again a very simple and easy process. Following steps can make your idea clear on this type of conversions. 1.The MSB of the binary number will be equal to the MSB of the given Gray code. 2.Now if the second Gray bit is 0, then the second binary bit will be the same as the previous or the first bit. If the Gray bit is 1 the second binary bit will alter. If it was 1 it will be 0 and if it was 0 it will be 1. 3. This step is continued for all the bits to do Gray code to binary conversion. DEE20033 DIGITAL ELECTRONICS
  • 68. 1.4.2 Gray Code to Binary Conversion Example 1. The MSB of the binary will be 0 as the MSB of gray is 0. Now move to the next gray bit. 2. As it is 1 the previous binary bit will alter i.e it will be 1, thus the second binary bit will be 1. 3. Next look at the third bit of the gray code. 4. It is again 1 thus the previous bit i.e the second binary bit will again alter and the third bit of the binary number will be 0. 5. Now, the 4th bit of the given gray is 0 so the previous binary bit will be unchanged, i.e 4th binary bit will be 0. 6. Now again the 5th grey bit is 1 thus the previous binary bit will alter, it will be 1 from 0. 7. Therefore the equivalent binary number in case of gray code to the binary conversion will be (01001). DEE20033 DIGITAL ELECTRONICS
  • 69. 1.5.1 1's Complement Form  The 1's complement form of any binary number is simply obtained by taking the complement form of 0 and 1.  1 to 0 and 0 to 1 * The range is –(2n-1 – 1) to +(2n-1-1). Example: Find the 1's complement 101001 Solution: 1 0 1 0 0 1 Binary Number 0 1 0 1 1 0 1's complement of Binary Number DEE20033 DIGITAL ELECTRONICS
  • 70.  The 2's complement form of binary number is obtained by taking the complement form of 0, 1 and adding 1 to LSB.  The range is –(2n-1) to (2n-1-1). Example: Find the 2's complement of 1110010 Solution: 1 1 1 0 0 1 0 Binary Number 0 0 0 1 1 0 1 1's complement + 1 Add 1 0 0 0 1 1 1 0 2's complement 1.5.2 2's Complement Form DEE20033 DIGITAL ELECTRONICS
  • 71. 1.5.3 Signed Number Representing Using 2's Complement Example: Express the Decimal number -25 in the 2's complement system using 8-bits. Solution: Represent the +25 in Binary for 0 0 0 1 1 0 0 1 1 1 1 0 0 1 1 0 ( 1's complement) +1 1 1 1 0 0 1 1 1 ( 2's complement) DEE20033 DIGITAL ELECTRONICS
  • 72. 1.5.3 2's complement Addition  The two number in addition are addend and augend which result in the sum.  The following five cases can be occur when two binary numbers are added; CASE 1: Both number are positive Straight Foward addition. Example: +8 and +4 in 5 bits 0 1000 ( + 8, augend) 0 0100 ( + 4, addend) 0 1 1 0 0 ( sum = + 12) signed bit DEE20033 DIGITAL ELECTRONICS
  • 73.  CASE 2: Positive number larger than negative number Example: Add two numbers +17 and -6 in six bits Solution: 0 1 0 0 0 1 (+17) 1 1 1 0 1 0 (-6) 1 0 0 1 0 1 1 (+11) The Final carry bit is disregarded 1.5.3 2's complement Addition DEE20033 DIGITAL ELECTRONICS
  • 74.  CASE 3: Positive number smaller than negative number  Example:  Add two numbers -8 and +4 Solution: 1 1 0 0 0 ( -8, augend) 0 0 1 0 0 ( +4, addend) 1 1 1 0 0 ( sum = -4) sign bit 1.5.3 2's complement Addition Since the SUM is negative, it is in 2's complement form. DEE20033 DIGITAL ELECTRONICS
  • 75.  Case 4: Both numbers are negative Example: Add two numbers -5 and -9 in 8 bits. Solution: 1 1 1 1 1 0 1 1 (-5) + 1 1 1 1 0 1 1 1 (-9) 1 1 1 1 1 0 0 1 0 (-14) The final carry bit is disregarded 1.5.3 2's complement Addition Since the SUM is negative, it is in 2's complement form. DEE20033 DIGITAL ELECTRONICS
  • 76.  when subtracting the binary number ( the subtrahend) from another binary number ( the minuend) then change the sign of the subtrahend and adds it to the minuend. Case 1: Both numbers are positive : Example: Subtract +41 from +75 in byte. Solution: Minuend ( +75) = 01001011 Subtrahend (+41)=00101001 Take the 2's complement form of subtrahend (+41) and add with miuend. 1.5.3 2's complement Subtraction DEE20033 DIGITAL ELECTRONICS
  • 77. 0 1 0 0 1 0 1 1 (+75) 1 1 0 1 0 1 1 1 (-41) 1 0 0 1 0 0 0 1 0 (+34) discard 1.5.3 2's complement Subtraction DEE20033 DIGITAL ELECTRONICS
  • 78.  CASE 2: Both numbers are negative Example: Subtract -30 from -80 in 8bit. Solution: In this case (-80) - (-30) = ( -80) + (30) 1 0 1 1 0 0 0 0 (-80) - 0 0 0 1 1 1 1 0 (+30) 1 1 0 0 1 1 1 0 (-50) 1.3.3 2's complement Subtraction DEE20033 DIGITAL ELECTRONICS
  • 79.  CASE 3 : Both numbers are opposite sign Example: Subtract -20 from + 24 in byte. Solution: In this case (+24) - (-20) = (+24)+(20) 0 0 0 1 1 0 0 0(+24) 0 0 0 1 0 1 0 0 (+20) 0 0 1 0 1 1 0 0 (+44) 1.3.3 2's complement Subtraction DEE20033 DIGITAL ELECTRONICS
  • 80. 1.5 How Binary CODES are Used in Computers  Binary codes are used in computers representing Decimal digits, alphanumeric characters and symbols.  When Numbers, letters or words are represented by a speacial group of symbols, we say that they are being encoded, and the group of symbols is called a code.  When a decimal number is represented by its equivalent binary number, we call it Straight Binary Coding. DEE20033 DIGITAL ELECTRONICS
  • 81.  BCD- Binary Coded Decimal Code  If each digit of a decimal number is represented by its binary equivalent, the result is a code called Binary Coded Decimal , BCD.  To illustrate the BCD code, take a Decimal number such as 874.  Each digit is changed to its Binary Equivalent as follows : 8 7 4 (Decimal) 1000 0111 0100 (BCD) 1.5.1 BCD 8421 codes DEE20033 DIGITAL ELECTRONICS
  • 82.  As another example, let us change 943 to its BCD- code representation: 9 4 3 (Decimal) 1001 0100 0011 ( BCD)  Once again, each decimal digit is changed to its straight Binary equivalent.  Note that 4 Bits are always used for each digit.  The BCD code, then represents each digit of the decimal number by a 4 Bit binary number. 1.5.1 BCD 8421 codes DEE20033 DIGITAL ELECTRONICS
  • 83.  Clearly only the 4-bit binary numbers from 0000 through 1001 are used.  The BCD code does not use the numbers 1010, 1011, 1100, 1101, 1110 and 1111.  In other words, only 10 of the 16 possible 4-bit binary code groups are used.  If any of the "forbidden" 4-bit numbers ever occurs in a machine using the BCD code, it is usually an indication that an error has occurred. 1.5.1 BCD 8421 codes DEE20033 DIGITAL ELECTRONICS
  • 84. Example: Convert 0110100000111001 (BCD) to its decimal equivalent. Solution: Divide the BCD number into 4-bit groups and convert each to decimal. 0110 1000 0011 1001 6 8 3 9 1.5.1 BCD 8421 codes DEE20033 DIGITAL ELECTRONICS
  • 85. Exercise: Convert the BCD number 011111000001 to its Decimal equivalent. Solution: 0111 1100 0001 7 1 Forbidden code group indicates error in BCD number 1.5.1 BCD 8421 codes DEE20033 DIGITAL ELECTRONICS
  • 86. 1.5.1 Comparison of BCD and Binary  It is important to realize that BCD is not another number system like binary, octal, decimal and Hexadecimal.  It is also important to understand that a BCD number is not the same as a straight binary number.  A straight binary code takes the complete decimal number and represents it in binary.  BCD code converts each decimal digit to binary individually.  Example: 13710 = 100010012 (binary) 13710 = 0001 0011 0111 (BCD) DEE20033 DIGITAL ELECTRONICS
  • 87. 1.5.2 Alphanumeric Codes  A computer should recognize codes that represent letters of the alphabet, puntuation marks, and other special characters as well as numbers.  A complete alphanumeric code would include the 26 lowercase latters, 26 uppercase latter, 10 numeric digits, 7 punctuation marks, and anywhere from 20 to 40 other characters such as + / * # and so on.  we can say that an alphanumeric code represents all of the various characters and functions that are found on a standard typewriter or computer keyboard. DEE20033 DIGITAL ELECTRONICS
  • 88.  The most widely used alphanumeric code.  American Standard Code for Information interchange (ASCII).  Pronounced "askee" Refer table next slide to see : Partial Listing of ASCII code. 1.5.2 Alphanumeric Codes - ASCII Code DEE20033 DIGITAL ELECTRONICS
  • 89. ASCII Reference Table DEE20033 DIGITAL ELECTRONICS
  • 90. Extended ASCII Codes DEE20033 DIGITAL ELECTRONICS
  • 91. Example: The following is a message encoded in ASCII code. What is the message? 1001000 1000101 1001100 1010000 Solution: Convert each 7-bit code to its Hexadecimal equivalent. The results are : 48 45 4C 50 Now, locate these Hexadecimal values in table ASCII and determine the character represented by each. The results are: H E L P 1.5.2 Alphanumeric Codes - ASCII Code DEE20033 DIGITAL ELECTRONICS
  • 92. References  "Digital Systems Principles And Application" Sixth Editon, Ronald J. Tocci.  "Digital Systems Fundamentals" P.W Chandana Prasad, Lau Siong Hoe, Dr. Ashutosh Kumar Singh, Muhammad Suryanata. sabariah@psas.edu.my sabariahsalihin@gmail.com
  • 93. The End Of Chapter 1...  Do Review Questions  Do Tutorial Questions sabariah@psas.edu.my sabariahsalihin@gmail.com