Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: What exactly are logic gates?

  1. Jan 16, 2005 #1
    Hello all

    Just refreshing for computer science midterm, and need to review logic gates. What exactly are logic gates? I know that they include AND OR XOR etc... but why is it really needed? Could you please provide some examples of their effiiciency in the real world?

    Thanks a lot
  2. jcsd
  3. Jan 16, 2005 #2


    User Avatar
    Homework Helper

    Those are called Boolean logic operations. Essentially such an operation acts on two bits (1 or 0) and produces a binary output (1 or 0). The relationship between all possible values the input(s) can take and the output can be reflected in a truth table.

    The basic Boolean operations you have to know are NOT, AND, OR and XOR. Then you have derived operations like NAND, NOR and XNOR.

    Boolean logic is useful both in software and in hardware.

    In software (programming), Boolean logic is important in making decisions to direct program flow. Like IF (condition A) AND (condition B) THEN (output C), etc.

    In hardware (electronics), you can get ICs (integrated circuits) that carry out these basic operations in digital logic circuits. For example, the 7404 chip is an inverter (NOT) chip. An extremely basic example of logic usage in hardware is for example when you put two switches in series to turn on (1) or off (0) a light. The light only comes on (1) when switch 1 is ON 'AND' switch 2 is ON. Or you could design a circuit that turns on a water sprinkler when the ambient light reaches a certain level 'OR' the relative humidity falls below a certain level, using the relevant transducers for detecting each of those conditions.

    The XOR operation has slightly more esoteric use, the simplest use I am aware of is in computing the bit in a binary addition (compare the XOR truth table to the following : 0 + 0 = 0, 1 + 0 = 1, 0 + 1 = 1, 1 + 1 = 0 [carry 1]).
    Last edited: Jan 16, 2005
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook