Basic Digital Logic 1

Embed Size (px)

Citation preview

  • 8/7/2019 Basic Digital Logic 1

    1/35

    1

    Basic Digital Logic 1Basic Gates

    Paul Godin

    [email protected]

    January 2004

    Created for the Western Canadian Robotics Society

    mailto:[email protected]:[email protected]
  • 8/7/2019 Basic Digital Logic 1

    2/35

    2

    Basic Digital Logic 1

    This presentation is about the basicconcepts of Digital Electronics:

    Basic Logic Concepts Basic Logic Functions

    Logic Symbols

    Truth Tables

  • 8/7/2019 Basic Digital Logic 1

    3/35

    3

    Basic Digital Logic 1

    Basic Logic Concepts

  • 8/7/2019 Basic Digital Logic 1

    4/35

    4

    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 binaryformat.Binary means 2 states.

    A good example of binary is a light(only on or off)

  • 8/7/2019 Basic Digital Logic 1

    5/35

    5

    Binary

    Base 2 = Base 10

    000 = 0

    001 = 1

    010 = 2

    011 = 3

    100 = 4101 = 5

    110 = 6

    111 = 7

    In Binary, there are only 0s and 1s. These

    numbers are called Base-2( Example: 0102)

    Binary

    toDecimal

    We count in Base-10(0 to 9)

  • 8/7/2019 Basic Digital Logic 1

    6/35

    6

    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.

  • 8/7/2019 Basic Digital Logic 1

    7/357

    A Simple Switch

    Here is a simple switch used toprovide a logic value:

    Vcc

    Gnd, or 0

    Vcc

    Vcc, or 1

    There are other ways to connect a switch.

  • 8/7/2019 Basic Digital Logic 1

    8/358

    Digital Logic

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

    AND

    OR

    NOT

  • 8/7/2019 Basic Digital Logic 1

    9/359

    The AND function

    The AND function:

    If all the inputs are high is the output ishigh

    If any input is low, the output is low

    If this input AND this input are

    high, the output is high

  • 8/7/2019 Basic Digital Logic 1

    10/3510

    AND Logic Symbol

    InputsOutput

    If both inputs are 1, the output is 1

    If any input is 0, the output is 0

  • 8/7/2019 Basic Digital Logic 1

    11/3511

    AND Logic Symbol

    Inputs Output

    Determine the output

    Animated Slide

    0

    0 0

  • 8/7/2019 Basic Digital Logic 1

    12/3512

    AND Logic Symbol

    Inputs Output

    Determine the output

    Animated Slide

    0

    1 0

  • 8/7/2019 Basic Digital Logic 1

    13/35

    13

    AND Logic Symbol

    Inputs Output

    Determine the output

    Animated Slide

    1

    1 1

  • 8/7/2019 Basic Digital Logic 1

    14/35

    14

    AND Truth Table

    To help understand the function of adigital device, a Truth Table is used:

    Input Output0 0 0

    0 1 0

    1 0 01 1 1

    AND Function

    Every possibleinput combination

  • 8/7/2019 Basic Digital Logic 1

    15/35

    15

    AND Gates

    It is possible to have AND gateswith more than 2 inputs. The samelogic rules apply if any input

  • 8/7/2019 Basic Digital Logic 1

    16/35

    16

    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

  • 8/7/2019 Basic Digital Logic 1

    17/35

    17

    OR Logic Symbol

    InputsOutput

    If any input is 1, the output is 1

    If all inputs are 0, the output is 0

  • 8/7/2019 Basic Digital Logic 1

    18/35

    18

    OR Logic Symbol

    Inputs Output

    Determine the output

    Animated Slide

    0

    0 0

  • 8/7/2019 Basic Digital Logic 1

    19/35

    19

    OR Logic Symbol

    Inputs Output

    Determine the output

    Animated Slide

    0

    1 1

  • 8/7/2019 Basic Digital Logic 1

    20/35

    20

    OR Logic Symbol

    Inputs Output

    Determine the output

    Animated Slide

    1

    1 1

  • 8/7/2019 Basic Digital Logic 1

    21/35

    21

    OR Truth Table

    Truth Table

    Input Output0 0 0

    0 1 1

    1 0 1

    1 1 1

    OR Function

  • 8/7/2019 Basic Digital Logic 1

    22/35

    22

    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 ofthe input

    The NOT function is often calledINVERTER

  • 8/7/2019 Basic Digital Logic 1

    23/35

    23

    NOT Logic Symbol

    Input Output

    If the input is 1, the output is 0

    If the input is 0, the output is 1

  • 8/7/2019 Basic Digital Logic 1

    24/35

    24

    NOT Logic Symbol

    InputOutput

    Determine the output

    Animated Slide

    0 1

  • 8/7/2019 Basic Digital Logic 1

    25/35

    25

    NOT Logic Symbol

    InputOutput

    Determine the output

    Animated Slide

    1 0

  • 8/7/2019 Basic Digital Logic 1

    26/35

    26

    NOT Truth Table

    Truth Table

    Input Output0 1

    1 0

    NOT Function

  • 8/7/2019 Basic Digital Logic 1

    27/35

    27

    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 logiclevel.

  • 8/7/2019 Basic Digital Logic 1

    28/35

    28

    REVIEW

    There are 3 basic gates:

    AND, where all inputs must be high fora high output

    OR, where any input must be high foran output high

    NOT, where the output is the opposite(compliment) of the input

  • 8/7/2019 Basic Digital Logic 1

    29/35

    29

    Exercise 1

    1. Least Challenging

    Complete the sentences:

    If all inputs of an OR gate are low, theoutput is_________

    If any input of an AND gate is low, theoutput is _________

    The output of a NOT gate is always the___________ of the input.

  • 8/7/2019 Basic Digital Logic 1

    30/35

    30

    Exercise 2

    2. A bit challenging:

    Convert the binary numbers to theirbase-10 value:

    0102= ___10

    01102=____10

    10012 = ____10

  • 8/7/2019 Basic Digital Logic 1

    31/35

    31

    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 thefront of the robot.

    Draw a diagram of the sensor switchand the connection to the motor.

  • 8/7/2019 Basic Digital Logic 1

    32/35

    32

    Exercise 4

    4. More Challenging A robot has two touch sensors and one

    motor. When pushed, the sensors

    produce a logic 1. The motor goesforward with a logic 0 and backwardwith a logic 1.

    If both sensors sense a touch, gobackward. 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)

  • 8/7/2019 Basic Digital Logic 1

    33/35

    33

    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). Alogic 1 will make them go forward and a logic 0will make them go backward.

    See the next slide for the desired operation.Design your circuit using switches, logic gatesand motors.

  • 8/7/2019 Basic Digital Logic 1

    34/35

    34

    Exercise 5

    Inputs Outputs

    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

    5. Continued

  • 8/7/2019 Basic Digital Logic 1

    35/35

    35

    End of Basic Digital Logic 1

    Copyright WCRS and Paul GodinFor non-profit use only

    mailto:[email protected]:[email protected]:[email protected]:[email protected]