Simple Digital Logic Design (H-Bridge)...Our Problem: H-bridge We want to build a device called an...

14
CS 3651 – Prototyping Intelligent Appliances Simple Digital Logic Design (H-Bridge) Georgia Institute of Technology

Transcript of Simple Digital Logic Design (H-Bridge)...Our Problem: H-bridge We want to build a device called an...

Page 1: Simple Digital Logic Design (H-Bridge)...Our Problem: H-bridge We want to build a device called an H-Bridge. An H-bridge is a simple motor controller that is used to provide 4 functions

CS 3651 – Prototyping Intelligent Appliances

Simple Digital Logic Design (H-Bridge)

Georgia Institute of Technology

Page 2: Simple Digital Logic Design (H-Bridge)...Our Problem: H-bridge We want to build a device called an H-Bridge. An H-bridge is a simple motor controller that is used to provide 4 functions

Aug 29 2007 2

Simple Digital Logic Design

  The basic steps in designing a simple digital circuit are:   Step 1: Define the problem

  Truth tables   Step 2: Translate truth tables into combinatorial logic circuit

  Boolean Algebra   Minterms   Sum of Products (or Product of Sums)

  Step 3: Optimization   Boolean Identities   DeMorgan’s Law   Karnaugh Maps (K-Maps)

  Step 4: Build It!   Protoboard and Integrated Circuits.

  Warning: This is a lot of information if it is your first exposure to circuits!

Page 3: Simple Digital Logic Design (H-Bridge)...Our Problem: H-bridge We want to build a device called an H-Bridge. An H-bridge is a simple motor controller that is used to provide 4 functions

Step 1: Define the Problem

  Digital logic circuits can contain multiple inputs and outputs.

  The combinations of inputs and outputs can be represented in a table form (called truth tables).

  Truth tables should list ALL the combinations of inputs and outputs.

Example: Inverter

Input Output

0 1

1 0

Page 4: Simple Digital Logic Design (H-Bridge)...Our Problem: H-bridge We want to build a device called an H-Bridge. An H-bridge is a simple motor controller that is used to provide 4 functions

Our Problem: H-bridge

  We want to build a device called an H-Bridge.   An H-bridge is a simple motor controller that is used to

provide 4 functions to an electric motor: Forward, Reverse, Brake, and Coast. The functions are selected with 2 input lines.

  The H-bridge is built with 4 switches, and allows voltage to be applied across the motor in either direction.

Photo courtesy of Wikipedia

Page 5: Simple Digital Logic Design (H-Bridge)...Our Problem: H-bridge We want to build a device called an H-Bridge. An H-bridge is a simple motor controller that is used to provide 4 functions

H-Bridge Truth Table

  H-Bridge input table H-Bridge output table

  H-Bridge full combinatorial logic full truth table

IN 2 IN 1 Function 0 0 Coast 0 1 Forward 1 0 Reverse 1 1 Brake

Function SW1 SW2 SW3 SW4 Coast 0 0 0 0 Forward 1 0 0 1 Reverse 0 1 1 0 Brake 1 1 0 0

IN2 IN1 SW1 SW2 SW3 SW4 Function 0 0 0 0 0 0 Coast 0 1 1 0 0 1 Forward 1 0 0 1 1 0 Reverse 1 1 1 1 0 0 Brake

Page 6: Simple Digital Logic Design (H-Bridge)...Our Problem: H-bridge We want to build a device called an H-Bridge. An H-bridge is a simple motor controller that is used to provide 4 functions

Step 2: Translate truth table into circuit

  All digital circuits can be built with some combination of AND, OR, and NOT gates.

  Depending on what gates you have available, you can redesign your circuit to use different types of gates (using DeMorgan’s Law).

  NAND gates are widely used.

A B OUT 0 0 1 0 1 1 1 0 1 1 1 0

Page 7: Simple Digital Logic Design (H-Bridge)...Our Problem: H-bridge We want to build a device called an H-Bridge. An H-bridge is a simple motor controller that is used to provide 4 functions

Step 2 cont.: Translate truth table into circuit

  These gates are available in integrated circuits that you can buy at electronics stores (RadioShack, Fry’s, etc.)

Page 8: Simple Digital Logic Design (H-Bridge)...Our Problem: H-bridge We want to build a device called an H-Bridge. An H-bridge is a simple motor controller that is used to provide 4 functions

Step 2 cont.: Translate truth table into circuit

  There are a couple different ways to translate a truth table into a physical circuit.

  One easy was is the Sum of Products method (SOP), another way is the Product of Sums (POS) method.

  These methods create a working circuit that is NOT optimized.

  Uses Boolean algebra (not the same as regular algebra) •  A=B+C A=B OR C •  A=B*C A=B AND C •  A=BC A=B AND C •  A=B A=NOT(B)

Page 9: Simple Digital Logic Design (H-Bridge)...Our Problem: H-bridge We want to build a device called an H-Bridge. An H-bridge is a simple motor controller that is used to provide 4 functions

Sum of Products

  Select the rows that generate a TRUE output, and then combine the terms with an OR gate.

  You do this separately for each output value (sw1. . .sw4). IN2 IN1 SW1 SW2 SW3 SW4 Function 0 0 0 0 0 0 Coast 0 1 1 0 0 1 Forward 1 0 0 1 1 0 Reverse 1 1 1 1 0 0 Brake

IN2 IN1 SW1 0 0 0 0 1 1 1 0 0 1 1 1

IN2 IN1 SW2 0 0 0 0 1 0 1 0 1 1 1 1

IN2 IN1 SW3 0 0 0 0 1 0 1 0 1 1 1 0

IN2 IN1 SW4 0 0 0 0 1 1 1 0 0 1 1 0

SW1= SW2= SW3= SW4=

IN2*IN1 + IN2*IN1 IN2*IN1 + IN2*IN1 IN2*IN1 IN2*IN1

Page 10: Simple Digital Logic Design (H-Bridge)...Our Problem: H-bridge We want to build a device called an H-Bridge. An H-bridge is a simple motor controller that is used to provide 4 functions

Sum of Products

IN2

IN1

IN2

IN1

SW1

IN2

IN1

IN2

IN1

SW2

SW1=IN2*IN1 + IN2*IN1

SW2=IN2*IN1 + IN2*IN1

IN2

IN1

IN2

IN1 SW3 SW4

SW3=IN2*IN1 SW4=IN2*IN1

Do you see any unnecessary gates?

Page 11: Simple Digital Logic Design (H-Bridge)...Our Problem: H-bridge We want to build a device called an H-Bridge. An H-bridge is a simple motor controller that is used to provide 4 functions

Step 3: Optimization – Boolean Identities

  Using Boolean identities, the circuit can be simplified.

Page 12: Simple Digital Logic Design (H-Bridge)...Our Problem: H-bridge We want to build a device called an H-Bridge. An H-bridge is a simple motor controller that is used to provide 4 functions

Step 3: Optimization – K Maps

  Karnaugh Maps are a graphical way to optimize circuits.

  It involves populating the K-map tables from the truth tables with the correct vales, and then grouping rectangles of 1’s together according to certain rules.

0 1

0

1

A

B

00 01

0

1

AB

C

11 10

00 01

00

01

AB

CD

11 10

11

10

4 Input K-Map

3 Input K-Map 2 Input K-Map

Page 13: Simple Digital Logic Design (H-Bridge)...Our Problem: H-bridge We want to build a device called an H-Bridge. An H-bridge is a simple motor controller that is used to provide 4 functions

Step 4: Build it!

M

Power

GND

IN2

IN1

Final Circuit

Page 14: Simple Digital Logic Design (H-Bridge)...Our Problem: H-bridge We want to build a device called an H-Bridge. An H-bridge is a simple motor controller that is used to provide 4 functions

Conclusion

  This method is great for prototyping because   1) It is really cheap. Each discrete logic chip is about 10

cents.   2) It is reliable, the chips do what you want them to do as

soon as you get them. No programming necessary.   The catch: it does not scale well for anything more than a

simple circuit.   FPGA (field programmable gate arrays) are used for more

complex circuits, and require the user to program the chips.