Fig. 1 DM74LS86N pin connections and truth table.
Brief Tutorial of XOR and XNOR Logic Gates
An Exclusive OR gate (XOR or EOR) is a digital gate that outputs a HIGH or TRUE logic level when two inputs, A and B, are different logic levels. Another variation is a Exclusive NOR that differs only with an inverted output. The output is LOW or FALSE when the inputs differ.
XOR gates are used to implement binary addition, subtraction, etc. They are of limited use with microcontrollers in external circuits. There are bitwise XOR functions used in programming. For example in Arduino this is used to invert bits useful for I-O ports. For example to toggle a LED connected to an I-O pin:
/* Blink LED PIN13 with XOR write directly to port. 502 bytes. Empty setup and loop 444 bytes Total program size 58 bytes from 628 bytes! Won't compile error on arduino-1.6.7-windows on XP */ // Total program size 58 bytes from 628 bytes! void setup() { DDRB = 0b00100000; // 4 bytes PORTB = 0x00; // 2 bytes } void loop() { // XOR PORTB with 0x20 toggles bit B.5 aka DP13 PORTB = PORTB ^ 0b00100000; // 8 bytes for (int i = 0; i <= 500; i++) { // 1000 uSec = 1 mS delayMicroseconds(1000); // 26 bytes } // for loop 18 bytes } // end loop
That is the reason I'm reviewing many basic digital circuits. It will enable on to better understand how program external hardware with a microcontroller. In the case above a bitwise XOR any bit XORed with 1 will be inverted in on pass. In reality the NOT (!) function seems too also be an XOR with 1 internally within the compiler.
For more on this subject see Arduino Blink LED Tutorial.
Fig. 2 - 74LS86 connections with LEDs.
Fig. 2 illustrates the electrical connections for the 74LS86 quad two-input XOR gate. The LEDs are ON only when the inputs differ. If one of the input pins is held HIGH or TRUE the state of the other pin HIGH or LOW will be inverted on the output. Thus any value be it a bit or 8-bits when XORed with a corresponding HIGH or binary 1 the output will be inverted.
The following three slides show how to construct an XOR or XNOR gate using other basic digital logic integrated circuits. There are many combinations.
Fig. 3 - XOR gate built from 2 AND gates, 2 inverters, and an OR gate.
Fig. 4 - XOR gate built from three 7400 NAND gates and 2 7404 inverters.
Fig. 5 -XNOR gate built from 2 7400 inverters, 2 7408 AND gates, and a 7402 NOR gate.
Fig. 6 -Build AND-OR gates from NAND-NOR gates.
- Simple Schmitt Trigger SN7414 Square Wave Generator
- SN7414 Square Wave Generator uses SN7476 JK Flip-Flop
- Three Output Pulse Generator Circuit for Digital Circuits
- Improved AC Zero Crossing Detectors for Arduino
- LM555-NE555 One-Shot Multivibrator AC Power Control
- Tutorial OR-NOR Circuits Including Monostable Multivibrator
- Introduction to RC Differentiator Circuits and Uses
- Brief Tutorial of XOR and XNOR Logic Gates
- Zero-Crossing Detectors Circuits and Applications
- Web Master
- Gen. Electronics
- YouTube Channel
- Arduino Projects
- Raspberry Pi & Linux
- PIC18F2550 in C
- PIC16F628A Assembly
- PICAXE Projects
- Bristol VA/TN
- Environmentalism
- US Constitution
- Religious Themes
- Religion Archive 1
- Comparator Theory Circuits Tutorial
- Constant Current Circuits with the LM334
- LM334 CCS Circuits with Thermistors, Photocells
- LM317 Constant Current Source Circuits
- TA8050P H-Bridge Motor Control
- All NPN Transistor H-Bridge Motor Control
- Basic Triacs and SCRs
- Comparator Hysteresis and Schmitt Triggers
- Comparator Theory Circuits Tutorial
- Photodiode Circuits Operation and Uses
- Optocoupler MOSFET DC Relays Using Photovoltaic drivers
- Connecting Crydom MOSFET Solid State Relays
- Photodiode Op-Amp Circuits Tutorial
- Optocoupler Input Circuits for PLC
- H11L1, 6N137A, FED8183, TLP2662 Digital Output Optocouplers
- Optical Isolation of H-Bridge Motor Controls
- All NPN Transistor H-Bridge Motor Control
- Arduino Projects Revisited Revised
- Schematic for Following Projects
- Programming ADS1115 4-Channel I2C ADC with Arduino
- Arduino uses ADS1115 with TMP37 to Measure Temperature
- Connect Arduino to I2C Liquid Crystal Display
- Arduino Reads Temperature Sensor Displays Temperature on LCD Display
- Arduino with MCP4725 12-bit Digital-to-Analog Converter Demo
- Videos
- Arduino with ADS1115 4-Channel 16-bit Analog-to-Digital Converter
- Arduino with MCP4725 12-Bit DAC
Videos:
My YouTube Videos on Electronics
Introduction to the Arduino Microcontroller
Part 1: Programming Arduino Output
Part 2: Programming Arduino Input
Part 3: Arduino Analog to Digital Conversion
Part 4: Using Arduino Pulse-Width-Modulation
Repost Arduino AC Power Control
- Comparator Theory Circuits Tutorial
- Constant Current Circuits with the LM334
- LM334 CCS Circuits with Thermistors, Photocells
- LM317 Constant Current Source Circuits
- TA8050P H-Bridge Motor Control
- All NPN Transistor H-Bridge Motor Control
- Basic Triacs and SCRs