Skip to main content
Workforce LibreTexts

2.3: Introduction to Logic

  • Page ID
    5125
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    Logic in Electronics

    While this lesson is a brief introduction to logic, understand that almost no part of our modern society can function without the touch of digital electronics. Everything from our TVs to phones, cars to gaming consoles, and computers to even the cash registers at the local grocery store would not be possible without these electronic devices. In this lesson, you’ll learn how to hard-wire these types of logical functions. Later, when you learn to use Programmable Logic Controllers (PLCs), you’ll also learn about the small electronic devices that perform the following functions.

    AND

    Logical AND
    Logical AND

    In words, the logical AND sounds something like this, “If A AND B are pressed, then Y is energized.”

    Considering A and B as our inputs, we can determine when Y (our output) is energized. Folks sometimes use a truth table to help analyze these functions. We use binary (using only the numerals 0 and 1) to help represent the state of our circuit. Binary can be used any time something only has two states (true/false, high/low, yes/no, open/closed, etc.). If “0” is the normal state, and “1” denotes an activated or energized state, let’s look a truth table for the AND function.

    AND
    A B Y
    0 0 0
    0 1 0
    1 0 0
    1 1 1

    The table is read row-by-row. In the first case, neither A or B is pressed, and Y is not activate. In the second row, A is not pressed, B is pressed, and Y is not energized. Notice that Y is only energized when both A and B are pressed. In any other case, lamp Y is not lit.

    OR

    Logical OR
    Logical OR

    In words, the logical OR description might be, “If button A OR B are pressed, then Y is energized.”

    The truth table for OR logic looks like the following. Notice that in this case, the only time lamp Y is not lit is in the first row when neither button is pressed. In all other cases, Y is energized.

    OR
    A B Y
    0 0 0
    0 1 1
    1 0 1
    1 1 1

    NOT

    Logical NOT
    Logical NOT

    Not is the simplest logical operation. It simply takes the input and inverts it. In our case, if button A is NOT pressed, then Y is energized (you could also say that if A is pressed, then Y is NOT energized). The truth table is shorter, since there’s only one input, and it looks like this:

    OR
    A Y
    0 1
    1 0

    NOR

    Logical NOR
    Logical NOR

    In the case of NOR, Y is energized as long as neither A NOR B is pushed. Notice that the truth table is an exact inverse of OR. In the case of OR, Y was energized if either button was pressed. With NOR, Y is de-energized if either button is pushed.

    NOR
    A B Y
    0 0 1
    0 1 0
    1 0 0
    1 1 0

    NAND

    Logical NAND
    Logical NAND

    With NAND, if both A and B are not pressed, then Y is energized. Notice the wording NOT AND. Looking at the truth table might confirm your suspicions. The output column for NAND is an inverse of the AND truth table.

    NAND
    A B Y
    0 0 1
    0 1 1
    1 0 1
    1 1 0

    XOR

    Logical XOR
    Logical XOR

    XOR (pronounced “ex-or” or “exclusive or”) allows us to energize Y if either A or B is pressed, but not if both are pressed. So, it’s function is like OR logic, but the load is not energized if both buttons are pressed.


    This page titled 2.3: Introduction to Logic is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Ken Dickson-Self (OpenOregon) via source content that was edited to the style and standards of the LibreTexts platform.

    • Was this article helpful?