Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy...

39
Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors looking right, center, and left. The car has two motors to drive the right and left wheels. Make a truth table with three inputs and two outputs, as shown below. (Please use these columns to simplify troubleshooting.) R Sensor L Sensor C Sensor L W heel R W heel

Transcript of Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy...

Page 1: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Homework - Write Truth Tables for toy car.

You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors looking right, center, and left. The car has two motors to drive the right and left wheels.

Make a truth table with three inputs and two outputs, as shown below. (Please use these columns to simplify troubleshooting.)

R Sensor L Sensor C Sensor L Wheel R Wheel

Page 2: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Evaluate truth tables for toy car.

R Sensor L Sensor C Sensor L Wheel R Wheel

0 0 0 0 or 1 opposite

0 0 1 1 1

0 1 0 0 1

0 1 1 0 or 1 1

1 0 0 1 0

1 0 1 1 0 or 1

1 1 0 na na

1 1 1 na na

Page 3: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

How does the computer manipulate numbers?

George Boole, a British mathematician (1815-1864).

Logic and math are equivalent.

All math functions can be determined using 3 primary logic operators:

AND OR NOT

Boolean logic is a complete system of logical operations.

Page 4: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

You already know Boolean logic.

Searched the Web for information. How would you get the technical specifications for a car

radio? Do you get the same information for “car radio”?

Page 5: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

The AND operator (both, all)

river salinity

dairy products exported to Europe

Page 6: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

The OR operator (either, any)

fruit OR vegetables

fruit OR vegetables OR cereal

from CSIRO Australia

Page 7: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

The NOT operator

fruit NOT apples

Page 8: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Let’s look at class using Boolean logic.

Please stand up if you are: male AND black hair AND left handed

Please stand up if you are: male OR black hair OR left handed

How has the group changed depending on the logical operator used.

Page 9: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Computers use electrical circuits called gates to manipulate numbers.

AND, OR, & NOT gates do all mathematical operations.

Page 10: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

AND gate

Two input bits produces one output bit. Both inputs must be true (1) for the output to be true. Otherwise the output is false (0).

A B Q

0 0 0

0 1 0

1 0 0

1 1 1

Page 11: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

OR gate

Two input bits produce one output bit. Either inputs must be true (1) for the output to be true.

A B Q

0 0 0

0 1 1

1 0 1

1 1 1

Page 12: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

NOT gate

The simplest possible gate is called an "inverter," or a NOT gate.

One bit as input produces its opposite as output.

A Q

0 1

1 0

From How Stuff Works

Page 13: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Google “JHU circuit builder”.

When you open circuit builder, specify the number of inputs and outputs.

Drag logic components into the circuit area to build your circuit.

Connect inputs (circles) to outputs (squares) by clicking first on one then dragging to the other. Inputs may have only a single connection but outputs may have multiple.

Once your circuit is completed you can choose either single input or all inputs to confirmation that your circuit operates correctly.

Page 14: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Design circuits using “circuit builder”.

Use circuit builder to confirm the logic behavior of Go to the movie if you have $10 and if you find a

ride. Fire alarm sounds if it senses heat or smoke.

Hav $10 Have ride Go movie0 0 01 0 00 1 01 1 1

heat smoke alarm0 0 01 0 10 1 11 1 1

Page 15: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Design circuit for voting.

People can vote if they are a citizen, are 18 and are registered. Conditions = citizen, 18, registered Action = vote

Citizen18 years old

Registered to vote Vote

0 0 0 00 0 1 00 1 0 00 1 1 01 0 0 01 0 1 01 1 0 01 1 1 1

Page 16: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Design circuit for R movie.

You can go to the R movie if you have $10 and if you are over 18 or accompanied by a parent.

Conditions = $10 and (>18 or parent) Action = go to movie

You have $10

You are over 18

Have Parent

Go to movie

0 0 0 00 0 1 00 1 0 00 1 1 01 0 0 01 0 1 11 1 0 11 1 1 1

Page 17: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Design circuit for safe but economical operations of toxic waste incinerator.

Want at least two sensors showing flame to open waste valve.

Page 18: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Control valve

If any two sensors show flame, open the valve.

Page 19: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Design circuit to alert for bad sensors.

Add a second output to show sensor agreement.

Page 20: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Sensor fault alarm

If sensor 1, 2 and 3 don’t agree, then show sensor fault.

Page 21: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Try this problem

Your home watering system will water the lawn if it is an odd day of month and the clock shows the preset time but not if the rain gage shows over 0.1 inch of water.

The system will shut off when the timer has reached 5 minutes.

Page 22: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Homework - design a toy car circuit using AND, OR & NOT.

R Sensor L Sensor C Sensor L Wheel R Wheel

0 0 0 0 or 1 opposite

0 0 1 1 1

0 1 0 0 1

0 1 1 0 or 1 1

1 0 0 1 0

1 0 1 1 0 or 1

1 1 0 na na

1 1 1 na na

Page 23: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Homework

R Sensor L Sensor C Sensor L Wheel R Wheel

0 0 0 0 or 1 opposite

0 0 1 1 1

0 1 0 0 1

0 1 1 0 or 1 1

1 0 0 1 0

1 0 1 1 0 or 1

1 1 0 na na

1 1 1 na na

Design your toy car circuit using AND, OR, & NOT gates.

Page 24: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

RW on when LS or CS on.LW on when RS or CS on.

Page 25: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

RW on (to seek) when no sensors are on.

Page 26: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Combine parts.

Page 27: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

What if you want the car to turn when both two sensors see it.

Page 28: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Computers make all logic decisions with one type of electronic gate.

All math operations can all be done with one type gate.

The most sophisticated computer can be made from only this gate.

Computer chip with 4 NAND gates.

Page 29: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

NAND is a NOT and an AND gate.

A B Q

0 0 1

0 1 1

1 0 1

1 1 0

A B Q

0 0 0

0 1 0

1 0 0

1 1 1

Not

Page 30: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Make a NOT gate from NAND gates.

A Q

0 1

1 0

Page 31: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Make an AND gate from NAND gates?

A B Q

0 0 0

0 1 0

1 0 0

1 1 1

Page 32: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Make an OR gate from NAND gates.

A B Q

0 0 0

0 1 1

1 0 1

1 1 1

Page 33: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Convert the control valve circuit to NAND gates.

NOT

AND

OR

Page 34: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Convert the sensor fault alarm to NAND gates and simplify the circuit.

If sensor 1, 2 and 3 don’t agree, then show sensor fault.

NOT

AND

OR

Page 35: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

NAND chips

14 pins Four NAND gates

Careful of I/O numbering Reversed on different

sides DC +5 volts on pin 14 Ground on pin 7

Page 36: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Map circuit design to chip locations.

chip

643

2

1

5

Page 37: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Cable from robot car

Page 38: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

The IC chips fits on a breadboard.

Connect wires between pins.

Each row is electrically connected.

Page 39: Homework - Write Truth Tables for toy car. You will design a simple digital circuit to make a toy car follow a flashlight. The car has three light sensors.

Homework

R Sensor L Sensor C Sensor L Wheel R Wheel

0 0 0 0 or 1 opposite

0 0 1 1 1

0 1 0 0 1

0 1 1 0 or 1 1

1 0 0 1 0

1 0 1 1 0 or 1

1 1 0 na na

1 1 1 na na

Convert your toy car circuit from AND, OR, & NOT gates to NAND gates and simplify to 2 chips max.

Number all gate I/O with chip pin numbers.