Digital Logic Design (ES216) Lec 4-6
Digital Logic Design (ES216) Lec 4-6
Department of Mechatronic
Engineering
Lec # 4-6
[email protected]
Lecture contents
• Decimal numbering system (Base 10) • Hexadecimal number systems
Positional Notation
Positional Notation
• Value of the number is determined by multiplying each digit by
weight and then summing it:
a3a2 a1a0 .a−1a−2 =
−1 −2
a3 r + a2 r + a1 r + a0 r + a−1 r
3 2 1 0
+ a− 2 r
Characteristics:
1. It holds only two values, i.e., either 0 or 1.
2. It is also known as the base 2 number system.
3. The position of the right digit represents the 0 power of the base(2). Example: 20
4. The position of the last left digit represents the x power of the base(2).
Binary number system
Example
126 + 125 + 124 + 123 + 022 + 121
+ 120
10110110
= 164 + 132 + 116 + 18 + 04 + 12
+ 11
= 123
127 + 026 + 125 + 124 + 023 + 122 + 121 + 120
Binary to decimal conversion
010101102
27*0 + 26*1 + 25*0 + 24*1+ 23*0+22*1+21*1+20*0
= 86 Answer
1011.10102
23*1+ 22*0+21*1+20*1 . 2-1*1 +2-2*0 +2-3*1 +2-4*0
8 + 0 + 2 + 1 . 1/2 + 0 + 1/8 + 0
=11.625 Answer
11112
23*1 +22*1 +21*1 +20*1
8*1+ 4*1+ 2*1+ 1*1
8+4+2+1=15 Answer
Binary Numbers
• Each binary digit (called bit) is either 1 or 0
• Bits having no inherent meaning, can represent
• Unsigned and signed integers Most Least
• Characters Significant Bit Significant Bit
• Floating-point numbers 7 6 5 4 3 2 1 0
• Bit Numbering
• Least significant bit (LSB) is rightmost (bit 0)
• Most significant bit (MSB) is leftmost (bit 7 in an 8-bit number)
Binary number chain
Bytes (Collection of Nibbles)
Some common
powers of 2
A thought
Why is any number to the power 0 equal 1?
Answer: The reason that any number to the zero power is one is because any
number to the zero power is just the product of no numbers at all, which is the
multiplicative identity, 1.
Octal number system (Base 8):
• The octal number system has base 8(means it has only eight digits from 0 to 7).
• With the help of only three bits, an octal number is represented.
• Each set of bits has a distinct value between 0 and 7.
• Characteristics:
1.An octal number system carries eight digits starting from 0, 1, 2, 3, 4, 5, 6, and 7.
2.It is also known as the base 8 number system.
3.The position of a digit represents the 0 power of the base(8). Example: 80
4.The position of the last digit represents the x power of the base(8).
Octal number system (Base 8):
Binary to octal conversion:
Group the binary positions in groups of 3
(35)8 Answer
(271)8 Answer
Octal to Binary conversion
• Open every octal digit in 3 bits
6 2 4
110 010 100
(110010100)2 Answer
2 7 1
010 111 001
(010111001)2 Answer
Octal to Decimal Conversion and vice versa
Convert 6248 to Decimal
= 6x82+2x81+4x80
= 384 + 16 + 4
= 40410
9 9H 01001
10 AH 01010
11 BH 01011
12 CH 01100
13 DH 01101
14 EH 01110
15 FH 01111
16 10H 10000
17 11H 10001
18 12H 10010
19 13H 10011
20 14H 10100
21 15H 10101
Binary to Hexadecimal conversion & vice versa
Convert 010101012 into (?)16 Convert 1010111112 into (?)16
0101 0101 0001 0101 1111
55H Answer 15FH Answer
“Encoding” is the process of converting the data or a given sequence of characters, symbols, alphabets etc., into
a specified format, for the secured transmission of data.
“Decoding” is the reverse process of encoding which is to extract the information from the converted format.
Examples of code systems: BCD, ASCII, etc.
When a decimal number is represented by its equivalent binary number, we call it (straight binary
coding).
Binary-coded decimal is a system of writing numerals that assigns a four-digit binary code to each digit
0 through 9 in a decimal (base 10) number. Simply put, binary-coded decimal is a way to convert decimal numbers
into their binary equivalents.
Binary coded decimal system
• Example: convert 49610 to BCD.
4 9 6
0100 1001 0110 = 010010010110BCD
• Each decimal digit is changed to its straight binary equivalent.
• Note that four bits are always used for each digit.
• BCD codes do not use the numbers 1010,1011,1100,1101,1110, &
1111, so if they are included means it’s an invalid BCD number.
Binary coded decimal system
• Convert 0101 1001 0010BCD to decimal.
0 0 0 0 0000
19 1111
23
51
24
59
01
823
Q: What is the largest decimal value that can be represented in binary using two
bytes?
A: 2 bytes = 16bits
2n = M => 216 = 65536
But as the range of binary numbers is from 0 to 2n-1
So 2n – 1 = 65535
Q: How many bytes are needed to represent the decimal value 846,569 in BCD?
A: 1000 0100 0110 0101 0110 1001 = 3 bytes
Parity Method for Error Detection
• Whenever information is transmitted from one device (the tx) to another device (the rx), there is a
possibility that errors.
• Errors can include loss of data, incorrect information, etc.
• Most modern digital equipment is designed to be relatively error-free, and the probability of errors
such as the one shown in the figure is very low.
• Digital systems often transmit thousands, even millions of bits/sec so even a very low rate of
occurrence of errors can produce an occasional error that might be bothersome, if not disastrous.
Parity Method for Error Detection
• One of the simplest & most widely used schemes for error detection is the parity check also known
as the Vertical Redundancy Check (VRC)
• A parity bit is an extra bit that is attached to a code group that is being transferred from one
location to another.
• The parity bit is made either 0 or 1, depending on the number of 1s that are contained in the code
group.
• Two different methods are used
1. Even parity
2. Odd parity
• In the Even parity method, the value of the parity bit is chosen so that the total number of 1s in
the code group (including the parity bit) is an even number.
• For eg: suppose that the group is 1000011 (ASCII of C).
Parity Method for Error Detection
• The code group has three 1s. Therefore, we will add a parity bit of 1 to make the total number of 1s
an even number. The new code group including the parity bit, thus becomes
• 1 1000011
• Parity bit can be placed at either end of the code group, but it is usually placed to the left of MSB.
• If the code group contains an even number of 1s to begin with, the parity bit is given a value of 0.
• For eg: 1000001 (ASCII of A)
• 0 1000001
erroneous
Example
Example: Computers often communicate with other remote computers over telephone lines. For e.g.: this
is how dial-up communication over the internet takes place. When one computer is transmitting a message
to another the information is usually encoded in ASCII. What actual bit strings would a PC transmit to
send the message, HELLO, using ASCII with even parity?
Solution:
H= 0 1001000
E= 1 1000101
L= 1 1001100
L= 1 1001100
O= 1 1001111