Sunday 4 May 2014

Logic Gates & Boolean Algebra



1. In this Chapter

We begin this chapter by studying the basic logic gates and understanding the fundamentals as well as the basic rules of Boolean algebra and expression simplification.



2. Basic Logic Gates

 Logic gates constitute the foundation blocks for digital logic. Let us start by reviewing these gates and their truth tables:
An AND Gate has two or more inputs and produces one output as follows: output = 1 if all of the inputs are high, output = 0 if one or more of the inputs are low.

An OR gate also has two or more inputs and produces one output as follows: output = 1 if one or more inputs are high, output = 0 if all inputs are low.




The inverter gate has one input and produces one output as follows: output =1 if input is low, output = 0 if input is high.
 


The NAND gate has two or more inputs and produces one output as follows: output = 0 if all the inputs are high, output = 1 if any of the inputs are low .





The NOR gate has two or more inputs and produces one output as follows: output = 1 if all inputs are low, output = 0 if any of the inputs is high .
 




The Exclusive-OR gate always has two inputs only and produces one output as follows: output = 1 when inputs are not similar, output = 0 when inputs are the same .
 


The Exclusive-NOR gate always has two inputs only and produces one output as follows: output = 1 when inputs are both high or are both low, output = 0 when inputs are not similar .





3. Boolean Algebra

Boolean algebra has similar rules to other algebras and these rules are used to manipulate the expression at hand. Some of these basic rules are .
 




One variable:           
                            A . A = A
                            A + A = A
One variable and 0 or 1:
                            A . 0 = 0
                            A . 1 = A
                            A + 0 = A
                            A + 1 = 1
DeMorgan’s Theorem:
                            (A + B)’ = A’ . B’
                            (A . B)’ = A’ + B’

Associative:
                            (A . B) . C = A . (B . C)
                            (A +B) + C = A + (B + C)
Commutative:
                            A . B = B . A
                            A + B = B + A



Distributive:
                            A .(B + C) = A . B + A . C
                            A + (B . C) = (A + B) . (A + C)
Note: OR operator is represented by the ‘+’ symbol and has the lowest precedence. NOT operator is represented by the “ ‘ “ symbol and has the highest precedence. AND operator is represented by ‘.’ symbol and is in the middle .






4. Example Exercise

STEP 1: Simplify the following expression: ABC’D + AB’C’D + A’BCD + AB’CD + A’BCD’ [3]
Answer Sub-Step 1: Using the above rules we can simplify the expression as follows.
ABC’D + AB’C’D + A’BCD + AB’CD + A’BCD’
 

= ABC'D + AB'C'D + A'BCD + A'BCD'+ AB'CD
= AC'D(B+B') + A'BC(D+D') + AB'CD
= AC'D(1) + A'BC(1) + AB'CD
= AC'D + A'BC + AB'CD
= AC'D + AB'CD + A'BC
= AD(C'+B'C) + A'BC
= AD((C'+B')(C'+C)) + A'BC
= AD((C'+B')(1)) + A'BC
= AD(BC)' + A'BC


5. Example Problem

STEP 2: Using NI Multisim, open circuit file “logic_gates.ms12”. You will notice the circuit below.
The above circuit shows the different connections of logic gates used to control a machine (indicated by an LED) in a workshop. There are On/Off switches, micro-switches, as well as emergency stop switches available (SW1 &SW2, SW3 & SW4, SW5 & SW6 respectively).
Answer Sub-step 2: Based on the circuit above, determine the switch combination that will turn the machine on.
Based on the individual truth tables for each of the logic gates, we start from the far right working our way back to determine the combination of bits or switches that will enable the LED to turn on or in other words the output of ‘U5’ to be equal to 1.




Input
Output
SW1 & SW2
SW3 & SW4
SW5 & SW6
LED
11
11
00
1
11
11
01
1
11
11
10
1
01
11
00
1
01
11
01
1
01
11
10
1
10
11
00
1
10
11
01
1
10
11
10
1


STEP 3: Using circuit file “logic_gates.ms12”, toggle the switches to replicate our findings and verify our combinations. You will notice that the LED will turn on when the above combinations are selected as shown below:



6. NI Suggested Solution

National Instruments offers a number of products that combine to provide a scalable and powerful teaching platform for educators. The solution includes:
NI Multisim circuit teaching environment: Combining an intuitive circuit definition environment, with powerful SPICE simulation technology, educators can use NI Multisim to easily teach the ins-and-outs of circuits in a safe environment.
NI ELVIS teaching and measurement platform allows educators to provide students with a compact, all-in-one unit for their measurement and analysis needs. Combining an oscilloscope, function generator, DMM, bode analyzer and 8 other instruments into a small platform; it simplifies the laboratory experience for students and lab instructors.