DIGITAL LOGIC
AND MICROPROCESSOR
[Link]
Assistant Professor(Senior Grade)
School of Electronics
VIT, Chennai
MODULE-1
REVIEW OF NUMBER SYSTEMS
Digital Systems
Examples of Digital systems
General purposes digital computer
Telephone switching exchanges
Digital voltmeters
Electronic calculators
Digital TV
Characteristics of a digital system
Manipulate discrete elements of information
For example, electric impulses, {1, 2, 3, …} and {A, B, C, …}…
Analog and Digital Signal
Analog system
The physical quantities or signals may vary continuously over a
specified range.
Digital system
The physical quantities or signals can assume only discrete values.
Greater accuracy X(t)
X(t)
t t
Analog signal Digital signal
Binary Digital Signal
For digital systems, the variable takes on discrete values.
Two level, or binary values are the most prevalent values.
Binary values are represented abstractly by:
Digits 0 and 1
Words (symbols) False (F) and True (T)
Words (symbols) Low (L) and High (H)
And words On and Off
Number System
Decimal Number System
Base (also called radix) = 10
10 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
Octal Number system
Base = 8
8 digits { 0, 1, 2, 3, 4, 5, 6, 7 }
Binary Number system
Base = 2
2 digits { 0, 1 }, called binary digits or “bits”
Hexadecimal Number system
Base = 16
16 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F }
General Expression for Number System
We can express any number in any base or radix, (X or r)
Any number with base X, having n digits to left and m digits to
right of decimal point.
.
MSD LSD
Number Base Conversions
Multiply by
source base
Octal
Divide by (Base 8)
destination base
Decimal Binary
(Base 10) (Base 2)
Hexadecimal
(Base 16)
Decimal (Integer) to Binary Conversion
Decimal (Fraction) to Binary Conversion
(13.625) 10 =(1101.101)2
Binary to Decimal Conversion
• Example : Convert (101111.1101)2 into its decimal equivalent
.
First, let’s deal with the integer part :
Similarly, the fraction part :
Hence, (101111.1101)2
= (47.8125)10
Exercise problem
1. Convert decimal number 25.125 into binary number
2. Convert binary 1010.011 to decimal
Decimal to Octal Conversion
Octal to Decimal Conversion
Example : Convert (237)8 and (120)8 to their decimal numbers.
Exercise problem
1. Convert decimal number 34.525 into octal number
2. Convert octal number 3462 into decimal number
Binary − Octal Conversion
Base is 8 = 23 Octal Binary
Each group of 3 bits represents an octal digit 0 000
Assume Zeros 1 001
Example:
2 010
( 1 0 1 1 0 . 0 1 )2 3 011
4 100
5 101
6 110
( 2 6 . 2 )8 7 111
Works both ways (Binary to Octal & Octal to Binary)
Binary − Hexadecimal Conversion
Hex Binary
Base is 16 = 24 0 0000
Each group of 4 bits represents an hexadecimal 1 0001
2 0010
digit 3 0011
Example: Assume Zeros
4 0100
5 0101
6 0110
7 0111
( 1 0 1 1 0 . 0 1 )2 8 1000
9 1001
A 1010
B 1011
C 1100
(1 6 . 4 )16 D
E
1101
1110
Works both ways (Binary to Hex & Hex to Binary) F 1111
Octal − Hexadecimal Conversion
Convert to Binary as an intermediate step
Example:
( 2 6 . 2 )8
Assume Zeros Assume Zeros
( 0 1 0 1 1 0 . 0 1 0 )2
(1 6 . 4 )16
Works both ways (Octal to Hex & Hex to Octal)
Decimal, Binary, Octal and Hexadecimal
Decimal Binary Octal Hex
00 0000 00 0
01 0001 01 1
02 0010 02 2
03 0011 03 3
04 0100 04 4
05 0101 05 5
06 0110 06 6
07 0111 07 7
08 1000 10 8
09 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
COMPLEMENTS
Complements are used in digital computers for simplifying the subtraction
operation and for logical manipulations
There are two types of complements for each number system of base-r : r’s
complement and (r-1)’s complement.
For Decimal System, value of r=10 and we get
•10’s Complement
•9’s Complement
In Binary System, value of r=2 and we get
•2’s Complement
•1’s Complement
Complements in Decimal Numbers
9’s complement
(rn – 1)–N = (104–1)–N = 9999–N
10’s Complement
(rn )–N = (104)–N = 10000–N
9’s complement subtraction
Add carry
10’s complement subtraction
Complements in Binary Numbers
Binary Number 1 0 1 1 0 0 0 00
10110000
1’s complement 01001111
+ 1
1
2’s complement 01010000
Subtraction of unsigned binary numbers
X = 1010100 and Y = 1000011
(a) X – Y ; and (b) Y X, using 2's complement.
Discard end carry.
There is no end carry.
Therefore, the answer is
Y – X = (2's complement
of 1101111) = 0010001.
Subtraction of unsigned binary numbers
X = 1010100 and Y = 1000011
(a) X – Y ; and (b) Y X, using 1's complement.
Signed Binary Numbers
To represent negative integers, we need a notation for negative values.
It is customary to represent the sign with a bit placed in the leftmost position of
the number since binary digits.
The convention is to make the sign bit 0 for positive and 1 for negative.
Example :
consider the number 9, represented in binary with eight bits,
+9= 0 0001001 and -9= 1 0001001
Generally -9 is represented in three formats with eight bits,
•Sign-Magnitude form
•1’s complement form
•2’s complement form
Signed Binary Numbers
Signed Binary Numbers
Arithmetic Addition:
If the signs are the same, add the two
magnitudes and give the sum the common sign.
If the signs are different, subtract the
smaller magnitude from the larger and
give the difference the sign of the larger
magnitude
Addition of two signed binary numbers with
negative numbers represented in signed-2's-complement
form is obtained from the addition of the two numbers,
including their sign bits.
Carry out of the sign-bit position is
discarded.
Signed Binary Numbers
Arithmetic Subtraction:
In 2’s-complement form:
1. Take the 2’s complement of the subtrahend (including the sign
bit) and add it to the minuend (including sign bit).
2. A carry out of sign-bit position is discarded.
( A) ( B ) ( A) ( B )
( A) ( B ) ( A) ( B )
Example:
( 6) ( 13) (11111010 11110011)
(11111010 + 00001101)
00000111 (+ 7)
Binary Coded Decimal( BCD)
BCD is combination of 4 binary digits represent decimal numbers
8421 code is type of BCD indicate binary weight of four bits
Ease of conversion between 8421 code numbers and decimal numbers
Any decimal number in BCD, each decimal digit should replaced by appropriate bit code
Example:
Consider decimal 185 in BCD and binary
Assignment
1. Subtract 347- 265 using 10’s complement
2. Subtract -33 from -57 using 2’scomplement
THANK YOU