Вы находитесь на странице: 1из 35

Basic Digital Logic 1

Basic Gates

Created for the Western Canadian Robotics Society

Paul Godin
godinp@telusplanet.net
January 2004

1
Basic Digital Logic 1
◊ This presentation is about the basic
concepts of Digital Electronics:
◊ Basic Logic Concepts
◊ Basic Logic Functions
◊ Logic Symbols
◊ Truth Tables

2
Basic Digital Logic 1

Basic Logic Concepts

3
Digital Signals
◊ Digital Signals have two basic states:
1 (logic “high”, or H, or “on”)
0 (logic “low”, or L, or “off”)

◊ Digital values are in a binary format.


Binary means 2 states.

◊ A good example of binary is a light


(only on or off)

4
Binary
In Binary, there are only 0’s and 1’s. These
numbers are called “Base-2” ( Example: 010 ) 2

Base 2 = Base 10

000 = 0
Binary to Decimal

001 = 1
010 = 2
We count in “Base-10”
011 = 3
100 = 4
(0 to 9)
101 = 5
110 = 6
111 = 7

5
Binary as a Voltage
Voltages are used to represent logic values:

A voltage present (called Vcc or Vdd) = 1

Zero Volts or ground (called gnd or Vss) = 0

A simple switch can provide a logic high or a logic low.

6
A Simple Switch
◊ Here is a simple switch used to
provide a logic value:

Vcc Vcc

Vcc, or 1 Gnd, or 0

There are other ways to connect a switch.


7
Digital Logic
◊ Basic Digital logic is based on 3
primary functions (the basic gates):

◊ AND

◊ OR

◊ NOT

8
The AND function
◊ The AND function:
◊ If all the inputs are high is the output is
high
◊ If any input is low, the output is low

◊ “If this input AND this input are


high, the output is high”

9
AND Logic Symbol

Inputs Output

If both inputs are 1, the output is 1

If any input is 0, the output is 0

10
AND Logic Symbol

0
Inputs 0 Output

0
Determine the output

Animated Slide

11
AND Logic Symbol

0
Inputs 0 Output

1
Determine the output

Animated Slide

12
AND Logic Symbol

1
Inputs 1 Output

1
Determine the output

Animated Slide

13
AND Truth Table
◊ To help understand the function of a
digital device, a Truth Table is used:
Input Output
Every possible
input combination 0 0 0
0 1 0
1 0 0
1 1 1
AND Function

14
AND Gates
◊ It is possible to have AND gates
with more than 2 inputs. The same
logic rules apply – “if any input…”

15
The OR function
◊ The OR function:
◊ if any input is high, the output is high
◊ if all inputs are low, the output is low

◊ “If this input OR this input is high,


the output is high”

16
OR Logic Symbol

Inputs Output

If any input is 1, the output is 1

If all inputs are 0, the output is 0

17
OR Logic Symbol

0
Inputs 0 Output

0
Determine the output

Animated Slide

18
OR Logic Symbol

0
Inputs 1 Output

1
Determine the output

Animated Slide

19
OR Logic Symbol

1
Inputs 1 Output

1
Determine the output

Animated Slide

20
OR Truth Table
◊ Truth Table

Input Output
0 0 0
0 1 1
1 0 1
1 1 1
OR Function

21
The NOT function
◊ The NOT function:
◊ If any input is high, the output is low
◊ If any input is low, the output is high

◊ “The output is the opposite state of


the input”

◊ The NOT function is often called


INVERTER
22
NOT Logic Symbol

Input Output

If the input is 1, the output is 0

If the input is 0, the output is 1

23
NOT Logic Symbol

Output
Input 0 1

Determine the output

Animated Slide

24
NOT Logic Symbol

Output
Input 1 0

Determine the output

Animated Slide

25
NOT Truth Table
◊ Truth Table

Input Output
0 1
1 0

NOT Function

26
REVIEW
◊ Digital Electronics works in Binary:

◊ There are 2 logic levels: high and low,


or 1 and 0.
◊ A switch can be used to provide a logic
level.

27
REVIEW
◊ There are 3 basic gates:

◊ AND, where all inputs must be high for


a high output

◊ OR, where any input must be high for


an output high

◊ NOT, where the output is the opposite


(compliment) of the input

28
Exercise 1
1. Least Challenging
◊ Complete the sentences:
◊ If all inputs of an OR gate are low, the
output is_________
◊ If any input of an AND gate is low, the
output is _________
◊ The output of a NOT gate is always the
___________ of the input.

29
Exercise 2
2. A bit challenging:
◊ Convert the binary numbers to their
base-10 value:

◊ 0102= ___10
◊ 01102=____10
◊ 10012 = ____10

30
Exercise 3
3. Challenging
◊ A robot has a motor that:
◊ goes forward when it gets a logic 1
◊ stops when it gets a logic 0
◊ There is a touch sensor switch at the
front of the robot.

◊ Draw a diagram of the sensor switch


and the connection to the motor.

31
Exercise 4
4. More Challenging
◊ A robot has two touch sensors and one
motor. When pushed, the sensors
produce a logic 1. The motor goes
forward with a logic 0 and backward
with a logic 1.
◊ If both sensors sense a touch, go
backward. If only one, or none of the
sensors sense a touch, go forward.
◊ Draw the sensors, motor and the logic
needed. (Hint: do a truth table)

32
Exercise 5
5. Expert Level
◊ A robot has three touch sensors (left, right,
middle). When pushed, they produce a logic 0.
The robot has two motors (left and right). A
logic 1 will make them go forward and a logic 0
will make them go backward.

◊ See the next slide for the desired operation.


Design your circuit using switches, logic gates
and motors.

33
Exercise 5
Inputs Outputs
5. Continued
L C R L R
0 0 0 0 0
0 0 1 0 1
0 1 0 1 1
0 1 1 1 1
1 0 0 1 0
1 0 1 1 1
1 1 0 1 1
1 1 1 1 1

34
End of Basic Digital Logic 1

Copyright WCRS and Paul Godin


For non-profit use only
35

Вам также может понравиться