Lect - Set - 2 - Number Systems, Operations and Codes
Lect - Set - 2 - Number Systems, Operations and Codes
CSB1202
Logic Design
Prof. Mohamed Abbas
Electrical Engineering Department
Faculty of Engineering, Assiut University
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
2
Lecture Set 2
Number Systems, Operations and Codes
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
3
Decimal Numbers
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
4
Decimal Numbers
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
5
Binary Numbers
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
6
Decimal Binary
Number Number
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
7
Binary Conversions
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
8
Binary Conversions
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
9
Binary Conversions
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
10
Binary Conversions
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
11
Binary Addition
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
12
Binary Addition
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
13
Binary Subtraction
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
14
1’s Complement
0 0 1 1 0 1 0 1
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
15
2’s Complement
0 0 1 1 0 1 1 0
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
16
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
17
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
18
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
19
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
20
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
21
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
22
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
23
8 8 1000
9 9 1001
Express 1A2F16 in decimal. 10 A 1010
11 B 1011
Start by writing the column weights:
12 C 1100
4096 256 16 1
13 D 1101
1 A 2 F16
14 E 1110
1(4096) + 10(256) +2(16) +15(1) = 670310 15 F 1111
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
24
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
25
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
26
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
27
BCD
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
28
BCD
A lab experiment in which BCD
is converted to decimal is shown.
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
29
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
30
Gray code
A shaft encoder is a typical application. Three IR
emitter/detectors are used to encode the position of the shaft.
The encoder on the left uses binary and can have three bits
change together, creating a potential error. The encoder on the
right uses gray code and only 1-bit changes, eliminating
potential errors.
Binary sequence
Gray code sequence
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
31
ASCII
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
32
Parity Method
The parity method is a method of error detection for
simple transmission errors involving one bit (or an odd
number of bits). A parity bit is an “extra” bit attached to
a group of bits to force the number of 1’s to be either
even (even parity) or odd (odd parity).
The ASCII character for “a” is 1100001 and for “A” is
1000001. What is the correct bit to append to make both of
these have odd parity?
The ASCII “a” has an odd number of bits that are equal to 1;
therefore the parity bit is 0. The ASCII “A” has an even
number of bits that are equal to 1; therefore the parity bit is 1.
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
33
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
34
Selected Key Terms
Electronic Devices, 9th edition © 2012 Pearson Education. Upper Saddle River, NJ, 07458.
Thomas L. Floyd All rights reserved.
35
Selected Key Terms