unit 3
unit 3
Logic Expressions
Each position represents a specific power of the base (10). For example, the decimal number
1234 consists of the digit 4 in the units position, 3 in the tens position, 2 in the hundreds
position, and 1 in the thousands position. Its value can be written as
Example:
Binary Number: 101012
Each position in a octal number represents a value of power of base (8) starting from the
position numbered from 0,1,2,etc. Example 80,81,etc
Example;
Octal Number: 125708
Letters represent the numbers starting from 10. A = 10. B = 11, C = 12, D = 13, E = 14,
F = 15
Each position in a hexadecimal number represents a value of power of base (16) starting
from the position numbered from 0,1,2,etc. Example 160,161,etc
Example:
Hexadecimal Number: 19FDE16
Step 2 19FDE16 ((1 x 164) + (9 x 163) + (15 x 162) + (13 x 161) + (14 x 160))10
Step 2 − Multiply the obtained column values (in Step 1) by the digits in the corresponding
columns.
Step 3 − Sum the products calculated in Step 2. The total is the equivalent value in decimal.
Example
Binary Number: 111012
Step 2 − Convert the decimal number so obtained to the new base number.
Example
Octal Number : 258
Step 1 21 / 2 10 1
Step 2 10 / 2 5 0
Step 3 5/2 2 1
Step 4 2/2 1 0
Step 5 1/2 0 1
Step 2 − Convert each group of three binary digits to one octal digit.
Example
Binary Number : 101012
Step 2 101012 28 58
Step 2 − Combine all the resulting binary groups (of 3 digits each) into a single binary number.
Example
Octal Number : 258
Step 2 − Convert each group of four binary digits to one hexadecimal symbol.
Example
Binary Number : 101012
Calculating hexadecimal Equivalent −
Step 2 − Combine all the resulting binary groups (of 4 digits each) into a single binary number.
Example
Hexadecimal Number : 1516
BCD needs more number of bits than binary to represent the decimal number. So BCD is
less efficient than binary.
Excess-3 code
The Excess-3 code is also called as XS-3 code. It is non-weighted code used to express decimal
numbers. The Excess-3 code words are derived from the 8421 BCD code words adding (0011)2
or (3)10 to each code word in 8421. The excess-3 codes are obtained as follows −
Example
Gray Code
It is the non-weighted code and it is not arithmetic codes. That means there are no specific
weights assigned to the bit position. It has a very special feature that, only one bit will change
each time the decimal number is incremented as shown in fig. As only one bit changes at a time,
the gray code is called as a unit distance code. The gray code is a cyclic code. Gray code cannot
be used for arithmetic operation.
A shaft position encoder produces a code word which represents the angular position of
the shaft.
1's complement
The 1's complement of a number is found by changing all 1's to 0's and all 0's to 1's. This is
called as taking complement or 1's complement. Example of 1's Complement is as follows.
2's complement
The 2's complement of binary number is obtained by adding 1 to the Least Significant Bit
(LSB) of 1's complement of the number.
Binary arithmetic is essential part of all the digital computers and many other digital system.
Binary Addition
It is a key for binary subtraction, multiplication, division. There are four rules of binary
addition.
In fourth case, a binary addition is creating a sum of (1 + 1 = 10) i.e. 0 is written in the given
column and a carry of 1 over to the next column.
Example − Addition
Binary Subtraction
Subtraction and Borrow, these two words will be used very frequently for the binary
subtraction. There are four rules of binary subtraction.
Example − Subtraction
Binary Multiplication
Binary multiplication is similar to decimal multiplication. It is simpler than decimal
multiplication because only 0s and 1s are involved. There are four rules of binary
multiplication.
Example − Multiplication
Binary Division
Binary division is similar to decimal division. It is called as the long division procedure.
Example − Division
Binary logic is always 0s and 1s. There is only one little problem though, electricity doesn’t
come in 0s or 1s it comes in high or low voltage. So, you need to kind of assign which is which.
And most of the time high voltage was assigned to be 1 and low voltage to be 0.
But you could also assign a high voltage to mean 0 and the low voltage to be 1 and there you
have it: negative logic.
You can of course create whole circuits using negativ logic, but most of the time it’s only used
for things like enable inputs or similar. You can easily spot them by the line on top of the input
name like: ENwhich would be an enable input that enables whatever can be enabled and disabled
by that input with a low voltage on this input.
Logic Gates:
Logic gates are the basic building blocks of any digital system. It is an electronic circuit having
one or more than one input and only one output. The relationship between the input and the
output is based on a certain logic. Based on this, logic gates are named as AND gate, OR gate,
NOT gate etc.
AND Gate:
A circuit which performs an AND operation is shown in figure. It has n input (n >= 2) and one
output.
Logic diagram
Truth Table
OR Gate
A circuit which performs an OR operation is shown in figure. It has n input (n >= 2) and one
output.
Logic diagram
Truth Table
NOT Gate
NOT gate is also known as Inverter. It has one input A and one output Y.
Logic diagram
Truth Table
NAND Gate
A NOT-AND operation is known as NAND operation. It has n input (n >= 2) and one output.
Logic diagram
Truth Table
NOR Gate
A NOT-OR operation is known as NOR operation. It has n input (n >= 2) and one output.
Logic diagram
Truth Table
XOR Gate
XOR or Ex-OR gate is a special type of gate. It can be used in the half adder, full adder and
subtractor. The exclusive-OR gate is abbreviated as EX-OR gate or sometime as X-OR gate. It
has n input (n >= 2) and one output.
Logic diagram
Truth Table
XNOR Gate
XNOR gate is a special type of gate. It can be used in the half adder, full adder and subtractor.
The exclusive-NOR gate is abbreviated as EX-NOR gate or sometime as X-NOR gate. It has n
input (n >= 2) and one output.
Logic diagram
Truth Table
Boolean Algebra
Boolean Algebra is used to analyze and simplify the digital (logic) circuits. It uses only the
binary numbers i.e. 0 and 1. It is also called as Binary Algebraor logical Algebra. Boolean
algebra was invented by George Boole in 1854.
Variable used can have only two values. Binary 1 for HIGH and Binary 0 for LOW.
ORing of the variables is represented by a plus (+) sign between them. For example
ORing of A, B, C is represented as A + B + C.
Logical ANDing of the two or more variable is represented by writing a dot between
them such as A.B.C. Sometime the dot may be omitted like ABC.
As well as the logic symbols “0” and “1” being used to represent a digital input or output, we can
also use them as constants for a permanently “Open” or “Closed” circuit or contact respectively.
A set of rules or Laws of Boolean Algebra expressions have been invented to help reduce the
number of logic gates needed to perform a particular logic operation resulting in a list of
functions or theorems known commonly as the Laws of Boolean Algebra.
Boolean Algebra is the mathematics we use to analyse digital gates and circuits. We can use
these “Laws of Boolean” to both reduce and simplify a complex Boolean expression in an
attempt to reduce the number of logic gates required. Boolean Algebra is therefore a system of
mathematics based on logic that has its own set of rules or laws which are used to define and
reduce Boolean expressions.
The variables used in Boolean Algebra only have one of two possible values, a logic “0” and a
logic “1” but an expression can have an infinite number of variables all labelled individually to
represent inputs to the expression, For example, variables A, B, C etc, giving us a logical
expression of A + B = C, but each variable can ONLY be a 0 or a 1.
Examples of these individual laws of Boolean, rules and theorems for Boolean Algebra are given
in the following table.
A in parallel with
A+1=1 Annulment
closed = "CLOSED"
A in parallel with
A+0=A Identity
open = "A"
A in series with
A.1=A Identity
closed = "A"
A in series with
A.0=0 Annulment
open = "OPEN"
A in parallel with
A+A=A Idempotent
A = "A"
A in series with
A.A=A Idempotent
A = "A"
A+A=1
A in parallel with
Complement
NOT A = "CLOSED"
A.A=0
A in series with
Complement
NOT A = "OPEN"
A in parallel with B =
A+B = B+A Commutative
B in parallel with A
A in series with B =
A.B = B.A Commutative
B in series with A
Annulment Law – A term AND´ed with a “0” equals 0 or OR´ed with a “1” will equal 1
Identity Law – A term OR´ed with a “0” or AND´ed with a “1” will always equal that term
Idempotent Law – An input that is AND´ed or OR´ed with itself is equal to that input
Complement Law – A term AND´ed with its complement equals “0” and a term OR´ed with
its complement equals “1”
Commutative Law – The order of application of two separate terms is not important
Double Negation Law – A term that is inverted twice is equal to the original term
(1) Two separate terms NOR´ed together is the same as the two terms inverted (Complement)
and AND´ed for example: A+B = A . B
(2) Two separate terms NAND´ed together is the same as the two terms inverted
(Complement) and OR´ed for example: A.B = A + B
Distributive Law – This law permits the multiplying or factoring out of an expression.
Associative Law – This law allows the removal of brackets from an expression and
regrouping of the variables.
Q= (A + B).(A + C)
Then the expression: (A + B)(A + C) can be simplified to A + (B.C) as in the Distributive law.