Professional Documents
Culture Documents
18B11EC215
Lecture 5
Codes and Boolean Algebra
1
Outline
■Excess-3 Codes
■Gray Codes
■Alphanumeric codes
▪ Digital Circuits
▪ Boolean Algebra
▪ Two –Valued Boolean Algebra
▪ Boolean Algebra Postulates
2
Excess-3 Codes[2]
■ This is another form of BCD Code , in which each decimal digit is coded into
a 4-bit binary code.
■ The code for each decimal digit is obtained by adding decimal 3 to the BCD
code of the digit.
■ Decimal 2 is coded as 0010 + 0011= 0101
■ It is not a weighted code.
■ It is a self complementing code, which means 1’s complement of the coded
number yields 9’s complement of the number it self.
■ Example : Excess 3 code for decimal 5 is 8 i.e., 1000 ,its 1’s complement is
0111,which is excess 3 code for decimal 4, which is 9’s complement of
decimal 5 itself.
3
Example[2]
4
Example[2]
(9 5 0)10
5
Gray Code[2,3]
■ It is a very useful code in which a decimal number is represented in binary form in such
a way so that each gray code number differs from the preceding and the succeeding
numbers by a single bit.
■ It is not a weighted code.
■ It is a reflected code.
■ A 1-bit gray code has two code words 0 and 1 representing decimal numbers 0 and 1.
6
Examples
7
More Examples
8
Conversion From Binary to Gray[2]
leftmost bit
■ Start with the most significant bit of the binary number.
■ Add the MSB of the binary to the next bit of the binary number.
■ The sum (ignoring carry) is the next bit of the gray code number.
■ Continue adding each bit of the binary to the next bit to its right to get the gray
code for that position as shown in the next slide
9
Conversion From Binary to Gray Cont…
10
Conversion From Gray to Binary[2]
■ Start with the most significant bit of the Gray number.
■ Add each binary digit generated, to the Gray digit in the next adjacent position .
11
Example[2]
Convert (11011)Gray to (?)2.
1 1 0 1 1
1 0 0 1 0
Ans : (10010)2
12
Example
■ Represent the decimal number 39 in
(i) Binary code
(ii) BCD code
(iii) Excess-3 code
(iv) Octal code
(v) Hexadecimal code
(vi) Gray code
13
Digital Circuits
▪ Digital circuit can be represented by a black-box with inputs on one side, and
outputs on the other.
The input/output signals are discrete/digital in nature, typically with two distinct
voltages (a high voltage and a low voltage).
High
Low
▪ Boolean Algebra named after George Boole who used it to study human
logical reasoning – calculus of proposition.
▪ Events : true or false
▪ Connectives : a OR b; a AND b, NOT a
▪ Example: Either “it has rained” OR “someone splashed water”, “must be tall”
AND “good vision”.
Boolean Algebra[1,2,3]
x x
x.y x+y x x'
y y
The set B = {0, 1} and the logical operations OR, AND and NOT satisfy all the
axioms of a Boolean algebra.
A Boolean function maps some inputs over {0,1} into {0,1}
A Boolean expression is an algebraic statement containing Boolean variables
and operators.
References
[1] M. Morris Mano and Michael D. Ciletti, “Digital Design with an Introduction to the
Verilog HDL,” 5th Edition, Pearson Education,2013.
[2] Reshu Gupta, Amit Gupta ,Atul Kumar Sharma “ Switching Theory(Digital
Electronics)”, Tech India Publication Series, Satya Prakashan, New Delhi.
[3] R. P. Jain, “Modern Digital Electronics,” 4th Edition, Tata McGraw-Hill Education,
2009.
22