Pages

Friday, August 31, 2012

Automatic Car Parking System with RFID









Radio-frequency identification (RFID) is an automatic identification method wherein the data stored on RFID tags or transponders is remotely retrieved. The RFID tag is a device that can be attached to or incorporated into a product, animal or person for identification and tracking using radio waves. Some tags can be read from several metres away, beyond the line of sight of the reader.



RFID technology is used in vehicle parking systems of malls and buildings (refer Fig. 1). The system normally consists of a vehicle counter, sensors, display board, gate controller, RFID tags and RFID reader. Presented here is an automatic vehicle parking system using AT89S52 microcontroller. 

                                                                                         Fig1:Automatic Vehicle Parking System

RFID system fundamentals
Basically, an RFID system consists of an antenna or coil, a transceiver (with decoder) and a transponder (RF tag) electronically programmed with unique information. There are many different types of RFID systems in the market. These are categorised on the basis of their frequency ranges. Some of the most commonly used RFID kits are low-frequency (30-500kHz), mid-frequency (900kHz-1500MHz) and high-frequency (2.4-2.5GHz).

RFID antenna. Fig. 2 shows the internal diagram of a typical RFID antenna. The antenna emits radio signals to activate the tag and read/write data from/to it. It is the conduit between the tag and the transceiver, which controls the system’s data acquisition and communication. 

Antennae are available in a variety of shapes and sizes. These can be built into a door frame to receive tag data from persons or things passing through the door, or mounted on an inter-state tollbooth to monitor the traffic passing by on a freeway. The electromagnetic 
Fig2: Internal diagram of a typical RFID antenna
field produced by the antenna can be constantly present when multiple tags are expected continually. If constant interrogation is not required, a sensor device can activate the field.

Often the antenna is packaged with a transceiver and decoder to act as a reader (interrogator), which can be configured either as a handheld or a fixed-mount device. The reader emits radio waves in the range of 2.5 cm to 30 metres or more, depending upon its power output and the radio frequency used. When an RFID tag passes through the electromagnetic zone, it detects the reader’s activation signal. The reader decodes the data encoded in the tag’s integrated circuit (silicon chip) and communicates to the host computer for processing. 


Tags (transponders). Fig. 3 shows the internal structure of a typical RFID tag. It comprises a microchip containing identifying information about the item and an antenna that transmits this data wirelessly to the reader. At its most basic, the chip contains a serialised identifier or licence plate number that uniquely identifies that item (similar to bar codes). A key difference, however, is that RFID tags have a higher data capacity than their bar code counterparts. This increases the options for the type of information that can be encoded on the tag; it may include the manufacturer’s name, batch or lot number, weight, ownership, destination and history (such as the temperature range to which an item has been 
                                                                                       Fig3: Internal structure of typical RFID tag
exposed). In fact, an unlimited list of other types of information can be stored on RFID tags, depending on the application’s requirements.

RFID tag can be placed on individual items, cases or pallets for identification purposes, as well as fixed assets such as trailers, containers and totes. There are different types of tags with varying capabilities:

1. Read-only tags contain such data as a serialised tracking number, which is pre-written onto these by the tag manufacturer or distributor. These are generally the least expensive tags as no additional information can be included when they move through the supply chain. Any update to the information has to be maintained in the application software that tracks the stock-keeping unit’s movement and activity.
2. Write-once tags enable the user to write data once in the production or distribution process. The data may include a serial number or lot or batch number.

3. Full read-write tags allow new data to be written to the tag—even over the original data—when needed. Examples include the time and date of ownership transfer or updating the 

Fig. 4: Block diagram of RFID-based automatic vehicle parking system
repair history of a fixed asset. While these are the most costly of the three tag types and impractical for tracking inexpensive items, future standards for electronic product codes (EPCs) appear to be headed in this direction.

Other features of the tag include:
Data capacity. The capacity of data storage on a tag can vary from 16 bits to several thousand bits. Of course, the greater the storage capacity, the higher the price of the tag.

Form factor. The tag and antenna structure can come in a variety of physical form factors and can either be self-contained or embedded as part of a traditional label structure (termed as ‘smart label,’ it has the tag inside what looks like a regular bar code label).

Passive and active. Passive tags have no battery and broadcast their data only when energised by a reader. It means these must be actively polled to send information. Active tags broadcast data using their battery power. This means their read range is greater than passive tags—around 30 metres or more, versus 5 metres or less for most passive tags.

The extra capability and read range of active tags, however, come at a cost. These are several times more expensive than passive tags. Today, active tags are much more likely to be used for high-value items or fixed assets such as trailers, where the cost is minimal compared to item value and very long read ranges are required. Most traditional supply chain applications, such as the RFID-based tracking and compliance programmes emerging in the consumer goods retail chain, use the less expensive passive tags.

Frequency range. Like all wireless communications, there are a variety of frequencies or spectra through which RFID tags communicate with readers. Again, there are trade-offs among cost, performance and application requirements. For instance, low-frequency tags are cheaper than ultra-high-frequency (UHF) tags, use less power and are better able to penetrate non-metallic substances. These are ideal for scanning objects with high water content, such as fruit, at close ranges.

UHFs typically offer longer range and can transfer data faster. But these use more power and are less likely to be effective with some materials.

Electronic product code (EPC) tags. EPC is an emerging specification for RFID tags, readers and business applications. It represents a specific approach to item identification, including an emerging standard for the tags—with both the data content of the tag and open wireless communication protocols.

RF transceiver. RF transceiver is the source of RF energy used to activate and power the passive RFID tags. It may be enclosed in the same cabinet as the reader or it may be a separate piece of equipment. When provided as a separate piece of equipment, the transceiver is commonly referred to as an RF module. RF transceiver controls and modulates the radio frequencies that the antenna transmits and receives. The transceiver filters and amplifies the backscatter signal from a passive RFID tag.

How this vehicle parking system works 
Fig. 4 shows the block diagram of the RFID-based automatic vehicle parking system.

To get started with RFID-based automatic vehicle parking system, the vehicle owner has to first register the vehicle with the parking owner and get the RFID tag. When the car has to be parked, the RFID tag is placed near the RFID reader, which is installed near the entry gate of the parking lot. As soon as the RFID tag is read by the reader, the system automatically deducts the specified amount from the RFID tag and the entry gate boomer opens to allow the car inside the parking area. At the same time, the  parking counter increments by one. Similarly, the door is opened at the exit gate and the parking counter decremented.

The system also offers the facility to recharge the amount for each RFID tag. No manual processing is involved. In addition, the system provides security.

Circuit description
The below circuit of the RFID-based automatic vehicle parking system. The circuit can be divided into different sections:

Power supply. Connector CON1 (refer Fig. 8), diodes D1 through D4, capacitor C1, and voltage regulator ICs 7805 (IC1) and 7812 (IC2) form the power supply section of the automatic vehicle parking system. CON1 is a three-pin connector that provides 15V AC or DC power supply to the circuit. In case of 15V AC, diodes D1 through D4 form a bridge rectifier to rectify the AC supply. Capacitor C1 filters out the ripples from the rectified output. ICs 7805 and 7812 provide regulated +5V and +12V, respectively, to the circuit. +5V is used to operate the microcontroller, LCD, RFID and IR sensor circuit and +12V operates the motor.

AT89S52 microcontroller. AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8kB Flash memory. It is compatible with the industry-standard 80C51 instruction set and pin-out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional non-volatile memory programmer. Other features include 256 bytes of RAM, 32 input/output lines, watchdog timer, two data pointers, three 16-bit timers/counters, a six-vector two-level interrupt architecture, a full-duplex serial port, on-chip oscillator and clock circuitry.

Connectors CON2 through CON4. CON2 and CON3 are two-pin connectors that connect the 12V DC motors to the circuit for controlling the entry and exit gate boomers. CON4 is a ten-pin dual-in-line female connector that connects the RFID reader module to the circuit.

L293D motor driver. H-bridge DC motor driver L293D (IC5) operates the DC motors to open the door or barrier for entry into and exit from the parking lot. Two high-current motor drivers can be used in place of L293D and 12V DC motors to control the entry and exit gates, respectively.

LM358 op-amp. Dual-operational amplifier LM358 (IC4) is used as a voltage comparator to compare the output of the IR sensors with a fixed threshold voltage in order to know whether the IR beam is interrupted or not.

IR transmitter and receiver. Two IR transmitter-receiver pairs are used. The IR LEDs are connected in forward-biased condition to the +5V power supply through 220-ohm resistors. These emit IR light, which is interrupted when an object comes into its way to the IR receiver. The IR receiving photodiodes are connected in reverse-biased condition to +5V power supply through 1-mega-ohm resistors. When the IR light falls on the photodiodes, their resistance changes and so does their output. This output is compared with a fixed voltage to give a digital output to the microcontroller in order to judge the entry and exit of the vehicles.

LCD display. LCD1 is a two-line, 16-character, alpha-numeric liquid crystal display. Data lines D0 through D7 of the LCD are connected to port 2 of AT89S52 (IC3). Reset (RS) and enable (E) control lines are connected to port pins P3.6 and P3.7, respectively. Control lines control data flow from the microcontroller to LCD1. 

When power is switched on, LED1 glows to indicate the presence of power in the circuit and LED2 glows to indicate the presence of RFID reader. Simultaneously, the ‘Automatic RFID Car Parking’ message is displayed on LCD1 along with a short beep from piezobuzzer PZ1. Transistor BC547 drives the buzzer. Pin details of 7805, 7812 and BC547 are shown in Fig. 6.

When a car crosses the IR LED1-D1 pair installed at the entry gate, the gate boomer does not open until an RFID tag is 

Fig6
placed near the RFID reader. After the tag is placed near the reader, the gate boomer opens for three seconds and closes automatically. If the initial recharge amount was Rs 900, the LCD display shows ‘Vehicle1 Amount’ in the first line and ‘Deducted 100’ in the second line, followed by ‘Balance Amount’ in the first line and ‘800’ in the second line. It is then followed by display of ‘Number of Cars’ in the first line and ‘001’ in the second line. If the parking lot is full, the message “Parking is Full, Sorry for Inconvenience” is displayed on LCD1.

When a car leaves the parking area and crosses the IR beam between IR LED2 and D2 at the exit gate, the vehicle count decreases by one. The LCD shows the number of cars in the parking lot along with “Thanks for Visiting” message.

Solar LED Lantern

This solar LED lantern can be used as an emergency light. Its 6V battery can be charged either from 230V, 50Hz AC mains or a 12V, 10W solar panel. Two LED indicators have been provided—red LED (LED1) indicates battery charging and green LED (LED2) indicates fully-charged battery.


You can choose to charge the battery either from the mains power or the solar panel by using the single-pole, double-throw (SPDT) switch. Capacitor C1 (1000µF, 35V) removes ripples from the power supply and regulator IC LM7809 (IC1) provides regulated 9V DC to the emitter of pnp transistor T1 (TIP127/BD140) and pin 7 of op-amp IC CA3140 (IC2), which is configured in comparator mode.


The reference voltage of 6.3V at pin 2 of IC2 is obtained through the combination of resistor R7 (1-kilo-ohm) and zener diode ZD1 (6.3V). The comparator controls charging of the battery. Pin 3 of IC2 is connected to the positive terminal of the battery to be charged through resistor R5. When the battery is fully charged, it stops charging and the green LED (LED2) glows to indicate the full-charge status.
 
When the battery voltage is low, diode D1 (1N4007) forward-biases and the battery connects (through resistor R3) to the collector of T1 for charging (indicated by the glowing of red LED1). Three high-wattage white LEDs (LED3 through LED5), such as KLHP3433 from Kwality Photonics, are used for lighting. These are switched on using switch S3. 

Friday, August 17, 2012

Motion Detection Circuit for Security Lamp

Here is a system based on PIR motion detector module BS1600 (or BS1700) that can be used for security or corridor lighting in power-saving mode. The 12V DC power supply required for the motion detector and the relay driver is derived from 230V, 50Hz mains using a transformerless circuit as shown below.


The working of the circuit is simple. When you power-on the circuit after assembling all the components including the CFL, the CFL will glow for 10 seconds, turn off for 30 seconds, glow for 10 seconds and then turn off. Now the circuit is ready to work.

When any movement is detected, around 3.3V appears on the base of relay-driver transistor T1 and it conducts to energise relay RL1. As a result, Triac1 (BT136) fires to provide full 230V and light up the CFL. Another normally-opened contact of the relay (N/O2) is used here to hold the output until reset. If the switch is not in 'hold' position, the light will remain 'on' for about ten seconds (as programmed in the motion sensor). In short, when there is a movement near the sensor, the CFL glows for about ten seconds. It will remain 'on' if switch S1 is in 'hold' position.

Assemble the circuit on a general-purpose PCB and enclose in a suitable cabinet. Use a three-pin connector for connecting the PIR sensor in the circuit with correct polarity. 

Thursday, August 9, 2012

IR Sensor based Visitor Counter


Visitor counting is simply a measurement of the visitor traffic entering and exiting offices, malls, sports venues, etc. Counting the visitors helps to maximise the efficiency and effectiveness of employees, floor area and sales potential of an organisation.
Visitor counting is not limited to the entry/exit point of a company but has a wide range of applications that provide information to management on the volume and flow of people throughout a location. A primary method for counting the visitors involves hiring human auditors to stand and manually tally the number of visitors who pass by a certain location. But human-based data collection comes at great expense. Here is a low-cost microcontroller based visitor counter that can be used to know the number of persons at a place. All the components required are readily available in the market and the circuit is easy to build.
Two IR transmitter-receiver pairs are used at the passage: one pair comprising IR transmitter IR TX1 and receiver phototransistor T1 is installed at the entry point of the passage, while the other pair comprising IR transmitter IR TX2 and phototransistor T2 is installed at the exit of the passage. The IR signals from the IR LEDs should continuously fall on the respective phototransistors, so proper orientation of the transmitters and phototransistors is necessary.
Circuit description

Two similar sections detect interruption of the IR beam and generate clock pulse for the microcontroller. The microcontroller controls counting and displays the number of persons present inside the hall. above figure shows the circuit of the microcontroller-based visitor counter, wherein the transmitter and the receiver form the IR detection circuit. Control logic is built around transistors, operational amplifier LM324 (IC1) and flip-flop (IC2). When nobody is passing through the entry/exit point, the IR beam continuously falls on phototransistorT1. Phototransistor T1 conducts and the high voltage at its emitter drives transistor T3 into saturation, which makes pin 3 of comparator N1 low and finally output pin 1 of comparator N1 is high. Now if someone enters the place, first the IR beam from IR TX1 is interrupted and then the IR beam from IR TX2. When the beam from IR TX1 is interrupted, phototransistor T1 and transistor T3 cut-off and pin 3 of comparator N1 goes high. The low output (pin 1) of comparator N1 provides negative trigger pulse to pin 1 of J-K flip-flop IC2(A). At this moment, high input at ‘J’ and ‘K’ pins of flip-flop IC2(A) toggles its output to low. On the other hand, the low input at ‘J’ and ‘K’ pins of IC2(B) due to clock pin 1 of IC2(A) and ‘J’ input (pin 9) and ‘K’ input (pin 12) of IC2(B) are connected to pin 1 of comparator N1. The negative-going pulse is applied to clock pin 6 of IC2(B) when the person interrupts the IR beam from IR TX2. There is no change in the output of IC2(B) flip-flop. This triggers the external interrupt INT0 (pin 12) of microcontroller AT89C52. The AT89C52 is an 8-bit microcontroller with 8 kB of flash-based program memory, 256 bytes of RAM, 32 input/output lines, three 16-bit timers/counters, on-chip oscillator and clock circuitry. A 12MHz crystal is used for providing clock. Ports 0, 1 and 2 are configured for 7-segment displays. Port-0 pin is externally pulled up with 10-kilo-ohm resistor network RNW1 because port-0 is an 8-bit, open-drain, bidirectional l, input/output (I/O) port. Port-1 andport-2 are 8-bit bidirectional I/O ports with internal pull-ups (no need of external pull-ups). Port pins 3.0 and 3.1 are configured to provide the set pulse to J-K flip-flops IC2(A) and IC2(B), respectively. External interrupts INT0 and INT1 receive the interrupt pulse when the person interrupts the IR beams. Resistor R9 and capacitor C5 provide power-on-reset pulse to the microcontroller. Switch S1 is used for manual reset. When the microcontroller is re- s e t , t h e flip-flops are b r o u g h t i n ‘ s e t ’ s t a t e through the microcontroller at software run time by making their ‘set’ pin high for a moment. The value of the counter increments by ‘1’ when the interrupt service routine for INT0 is executed .The output of the corresponding J-K flip-flop is set to ‘high’ again by making its ‘set’ input pin low through the microcontroller. The micro-controller is configured as a negative-edge triggered interrupt sensor. Similarly, if somebody exits the place, first the IR beam from IR TX2 is interrupted and then the IR beam from IR TX1. When the beam from IR TX2 is interrupted, output pin 7 of comparator N2 goes low. This provides clock pulse to pin 6 of J-K flip-flop IC2(B).
   
At  this  moment,  the  high  input at ‘J’ and ‘K’ pins of  flip-flop IC2(B) toggles its output to low. On the other hand, the low input at ‘J’ and ‘K’ pins of IC2(A) due to clock pin 6 of IC2(B) and ‘J’ input (pin 4) and ‘K’ input (pin16) of IC2(A) are connected to pin 7 of comparator N2.
The  negative-going  pulse  is  ap- plied to clock pin 1 of IC2(A) when the person interrupts the IR beam from IR TX1. There is no change in the output of  IC2(A)  flip-flop. This  triggers  the external  interrupt  INT1  (pin  13)  of microcontroller  AT89C52.  The  value of the counter decrements by ‘1’ when interrupt service routine for INT1 is ex- ecuted. The output of the correspond ing J-K flip-flop is set to ‘high’ again by making its ‘set’ input pin low through the microcontroller.

The  circuit  is  powered  by  regulated 5V. Above figure shows the  circuit of the power supply. The  AC mains is stepped down by  transformer X1 to deliver  secondary  output  of  7.5V,
250mA, which is rectified by  bridge rectifier BR1, filtered by capacitor C6 and regulated by  IC 7805 (IC4). Ca- pacitor C7 bypasses any ripple in the regulated output.

 code:


Wednesday, August 8, 2012

Basic idea On PWM


Pulse-width modulation (PWM), or pulse-duration modulation (PDM), is a commonly used technique for controlling power to inertial electrical devices, made practical by modern electronic power switches.
The average value of voltage (and current) fed to the load is controlled by turning the switch between supply and load on and off at a fast pace. The longer the switch is on compared to the off periods, the higher the power supplied to the load is.
The PWM switching frequency has to be much faster than what would affect the load, which is to say the device that uses the power. Typically switchings have to be done several times a minute in an electric stove, 120 Hz in a lamp dimmer, from few kilohertz (kHz) to tens of kHz for a motor drive and well into the tens or hundreds of kHz in audio amplifiers and computer power supplies.
The term duty cycle describes the proportion of 'on' time to the regular interval or 'period' of time; a low duty cycle corresponds to low power, because the power is off for most of the time. Duty cycle is expressed in percent, 100% being fully on.
The main advantage of PWM is that power loss in the switching devices is very low. When a switch is off there is practically no current, and when it is on, there is almost no voltage drop across the switch. Power loss, being the product of voltage and current, is thus in both cases close to zero. PWM also works well with digital controls, which, because of their on/off nature, can easily set the needed duty cycle.
PWM has also been used in certain communication systems where its duty cycle has been used to convey information over a communications channel.

In telecommunications, the widths of the pulses correspond to specific data values encoded at one end and decoded at the other.
Pulses of various lengths (the information itself) will be sent at regular intervals (the carrier frequency of the modulation).
          _      _      _      _      _      _      _      _     
         | |    | |    | |    | |    | |    | |    | |    | |    
Clock    | |    | |    | |    | |    | |    | |    | |    | |    
       __| |____| |____| |____| |____| |____| |____| |____| |____
                 _      __     ____          ____   _
PWM Signal      | |    |  |   |    |        |    | | |
                | |    |  |   |    |        |    | | |
       _________| |____|  |___|    |________|    |_| |___________
Data       0     1       2      4      0      4     1      0
The inclusion of a clock signal is not necessary, as the leading edge of the data signal can be used as the clock if a small offset is added to the data value in order to avoid a data value with a zero length pulse.
                _      __     ___    _____   _      _____   __     _   
               | |    |  |   |   |  |     | | |    |     | |  |   | | 
PWM Signal     | |    |  |   |   |  |     | | |    |     | |  |   | |  
             __| |____|  |___|   |__|     |_| |____|     |_|  |___| |_____

Data            0       1      2       4     0        4      1     0

[edit]Sample C Code to Generate PWM

Code:
void delay_ms(unsigned int i)
{
unsigned int j;
while(i-->0)
{
for(j=0;j<500 font="font" j="j">
{
;
}
}
}
void delay_micro(unsigned int i)
{
unsigned int s;
for(s=0;s
{
;
}
}

void main()
{
unsigned int i;
while(1)
{
for(i=0;i<200 font="font" i="i">
{
led=0;
delay_micro(i);
led=1;
delay_ms(20);
}
}
}

Digital Logic Gates Tutorial



Introduction to Digital Logic Gates


Digital Logic Gate is an electronic device that makes logical decisions based on the different combinations of digital signals present on its inputs. A digital logic gate may have more than one input but only has one digital output. Standard commercially available digital logic gates are available in two basic families or forms, TTL which stands for Transistor-Transistor Logic such as the 7400 series, andCMOS which stands for Complementary Metal-Oxide-Silicon which is the 4000 series of chips. This notation of TTL or CMOS refers to the logic technology used to manufacture the integrated circuit, (IC) or a "chip" as it is more commonly called.
Digital logic gate

Integrated Circuits
 or IC's as they are more commonly called, can be grouped together into families according to the number of transistors or "gates" that they contain. For example, a simple AND gate my contain only a few individual transistors, were as a more complex microprocessor may contain many thousands of individual transistor gates. Integrated circuits are categorised according to the number of logic gates or the complexity of the circuits within a single chip with the general classification for the number of individual gates given as:Generally speaking, TTL IC's use NPN (or PNP) type Bipolar Junction Transistors while CMOS IC's use Field Effect Transistors or FET's for both their input and output circuitry. As well as TTL and CMOS technology, simple digital logic gates can also be made by connecting together diodes, transistors and resistors to produce RTL, Resistor-Transistor logic gates, DTL, Diode-Transistor logic gates or ECL, Emitter-Coupled logic gates but these are less common now compared to the popular CMOS family.

Classification of Integrated Circuits

  • Small Scale Integration or (SSI) - Contain up to 10 transistors or a few gates within a single package such as AND, OR, NOT gates.
  •  
  • Medium Scale Integration or (MSI) - between 10 and 100 transistors or tens of gates within a single package and perform digital operations such as adders, decoders, counters, flip-flops and multiplexers.
  •  
  • Large Scale Integration or (LSI) - between 100 and 1,000 transistors or hundreds of gates and perform specific digital operations such as I/O chips, memory, arithmetic and logic units.
  •  
  • Very-Large Scale Integration or (VLSI) - between 1,000 and 10,000 transistors or thousands of gates and perform computational operations such as processors, large memory arrays and programmable logic devices.
  •  
  • Super-Large Scale Integration or (SLSI) - between 10,000 and 100,000 transistors within a single package and perform computational operations such as microprocessor chips, micro-controllers, basic PICs and calculators.
  •  
  • Ultra-Large Scale Integration or (ULSI) - more than 1 million transistors - the big boys that are used in computers CPUs, GPUs, video processors, micro-controllers, FPGAs and complex PICs.
While the "ultra large scale" ULSI classification is less well used, another level of integration which represents the complexity of the Integrated Circuit is known as the System-on-Chip or (SOC) for short. Here the individual components such as the microprocessor, memory, peripherals, I/O logic etc, are all produced on a single piece of silicon and which represents a whole electronic system within one single chip, literally putting the word "integrated" into integrated circuit. These chips are generally used in mobile phones, digital cameras, micro-controllers, PICs and robotic applications, and which can contain up to 100 million individual silicon-CMOS transistor gates within one single package.

Moore's Law

In 1965, Gordon Moore co-founder of the Intel corporation predicted that "The number of transistors and resistors on a single chip will double every 18 months" regarding the development of semiconductor gate technology. When Moore made his famous comment way back in 1965 there were approximately only 60 individual transistor gates on a single silicon chip or die. Today, the Intel Corporation have placed around 2.0 Billion individual transistor gates onto its new Quad-core Itanium 64-bit microprocessor chip and the count is still rising!.

Digital Logic States

The Digital Logic Gate is the basic building block from which all digital electronic circuits and microprocessor based systems are constructed from. Basic digital logic gates perform logical operations of ANDOR and NOT on binary numbers. In digital logic design only two voltage levels or states are allowed and these states are generally referred to as Logic "1" and Logic "0"High and Low,True and False and which are represented in Boolean Algebra and Truth Tables by the binary digits of "1" and "0" respectively. A good example of a digital signal is a simple light as it is either "ON" or "OFF" but not both at the same time.
Most digital logic gates and logic systems use "Positive logic", in which a logic level "0" or "LOW" is represented by a zero voltage, 0v or ground and a logic level "1" or "HIGH" is represented by a higher voltage such as +5 volts, with the switching from one voltage level to the other, from either a logic level "0" to a "1" or a "1" to a "0" being made as quickly as possible to prevent any faulty operation of the logic circuit. There also exists a complementary "Negative Logic" system in which the values and the rules of a logic "0" and a logic "1" are reversed but in this tutorial section about digital logic gates we shall only refer to the positive logic convention as it is the most commonly used.
In standard TTL (transistor-transistor logic) IC's there is a pre-defined voltage range for the input and output voltage levels which define exactly what is a logic "1" level and what is a logic "0" level and these are shown below.

TTL Input & Output Voltage Levels


There are a large variety of logic gate types in both the bipolar 7400 and the CMOS 4000 families of digital logic gates such as 74Lxx, 74LSxx, 74ALSxx, 74HCxx, 74HCTxx, 74ACTxx etc, with each one having its own distinct advantages and disadvantages compared to the other. The exact switching voltage required to produce either a logic "0" or a logic "1" depends upon the specific logic group or family. However, when using a standard +5 volt supply any TTL voltage input between 2.0v and 5v is considered to be a logic "1" or "HIGH" while any voltage input below 0.8v is recognised as a logic "0" or "LOW". The voltage region in between these two voltage levels either as an input or as an output is called the Indeterminate Region and operating within this region may cause the logic gate to produce a false output. The CMOS 4000 logic family uses a different level of voltages compared to the TTL types with a logic "1" level operating between 3.0 and 18 volts and a logic "0" level below 1.5 volts.
Then from the above observations, we can define the ideal Digital Logic Gate as one that has a "LOW" level logic "0" of 0 volts (ground) and a "HIGH" level logic "1" of +5 volts and this can be demonstrated as:

Ideal Digital Logic Voltage Levels


Where the opening or closing of the switch produces either a logic level "1" or a logic level "0" with the resistor R being known as a "pull-up" resistor.

Simple Basic Digital Logic Gates

Simple digital logic gates can be made by combining transistors, diodes and resistors with a simple example of a Diode-Resistor Logic (DRL) AND gate and a Diode-Transistor Logic (DTL) NAND gate given below.
Diode-Resistor circuitDiode-Transistor circuit


2-input AND gate


2-input NAND gate
The simple 2-input Diode-Resistor AND gate can be converted into a NAND gate by the addition of a single transistor inverting (NOT) stage. Using discrete components such as diodes, resistors and transistors to make digital logic gate circuits are not used in practical commercially available logic IC's as these circuits suffer from propagation delay or gate delay and power loss due to the pull-up resistors, also there is no "Fan-out" facility which is the ability of a single output to drive many inputs of the next stages. Also this type of design does not turn fully "OFF" as a Logic "0" produces an output voltage of 0.6v (diode voltage drop), so the following TTL and CMOS circuit designs are used instead.

Basic TTL Logic Gates

The simple Diode-Resistor AND gate above uses separate diodes for its inputs, one for each input. As a transistor is made up off two diode circuits connected together representing an NPN or a PNP device, the input diodes of the DTL circuit can be replaced by one single NPN transistor with multiple emitter inputs as shown.
2-input NAND gate


In standard TTL logic gates, the transistors operate either completely in the "cut off" region, or else completely in the saturated region, 
Transistor as a Switch type operation.As the gate contains a single stage inverting NPN transistor circuit (TR2) an output logic level "1" at Q is only present when both the emitters of TR1 are connected to logic level "0" or ground allowing base current to pass through the PN junctions of the emitter and not the collector. The multiple emitters of TR1 are connected as inputs thus producing a NAND gate function.


Emitter-Coupled Digital Logic Gate

Emitter Coupled Logic or ECL is another type of digital logic gate that uses bipolar transistor logic where the transistors are not operated in the saturation region, as they are with the standard TTL digital logic gate. Instead the input and output circuits are push-pull connected transistors with the supply voltage negative with respect to ground. This has the effect of increasing the speed of operation of the ECL gates up to the Gigahertz range compared with the standard TTL types, but noise has a greater effect in ECL logic, because the unsaturated transistors operate within their active region and amplify as well as switch signals.

The "74" Sub-families of Integrated Circuits

With improvements in the circuit design to take account of propagation delays, current consumption, fan-in and fan-out requirements etc, this type of TTL bipolar transistor technology forms the basis of the prefixed "74" family of digital logic IC's, such as the "7400" Quad 2-input AND gate, or the "7402" Quad 2-input OR gate. Sub-families of the 74xx series IC's are available relating to the different technologies used to fabricate the gates and they are denoted by the letters in between the 74 designation and the device number. There are a number of TTL sub-families available that provide a wide range of switching speeds and power consumption such as the 74L00 or 74ALS00 AND gate, were the "L" stands for "Low-power TTL" and the "ALS" stands for "Advanced Low-power Schottky TTL" and these are listed below.
  • 74xx or 74Nxx: Standard TTL - These devices are the original TTL family of logic gates introduced in the early 70's. They have a propagation delay of about 10ns and a power consumption of about 10mW.
  •  
  • 74Lxx: Low Power TTL - Power consumption was improved over standard types by increasing the number of internal resistances but at the cost of a reduction in switching speed.
  •  
  • 74Hxx: High Speed TTL - Switching speed was improved by reducing the number of internal resistances. This also increased the power consumption.
  •  
  • 74Sxx: Schottky TTL - Schottky technology is used to improve input impedance, switching speed and power consumption (2mW) compared to the 74Lxx and 74Hxx types.
  •  
  • 74LSxx: Low Power Schottky TTL - Same as 74Sxx types but with increased internal resistances to improve power consumption.
  •  
  • 74ASxx: Advanced Schottky TTL - Improved design over 74Sxx Schottky types optimised to increase switching speed at the expense of power consumption of about 22mW.
  •  
  • 74ALSxx: Advanced Low Power Schottky TTL - Lower power consumption of about 1mW and higher switching speed of about 4nS compared to 74LSxx types.
  •  
  • 74HCxx: High Speed CMOS - CMOS technology and transistors to reduce power consumption of less than 1uA with CMOS compatible inputs.
  •  
  • 74HCTxx: High Speed CMOS - CMOS technology and transistors to reduce power consumption of less than 1uA but has increased propagation delay of about 16nS due to the TTL compatible inputs.

Basic CMOS Digital Logic Gate

One of the main disadvantages of the TTL logic series is that the gates are based on bipolar transistor logic technology and as transistors are current operated devices, they consume large amounts of power from a fixed +5 volt power supply. Also, TTL bipolar transistor gates have a limited operating speed when switching from an "OFF" state to an "ON" state and vice-versa called the "gate" or "propagation delay". To overcome these limitations complementary MOS called "CMOS" logic gates using "Field Effect Transistors" or FET's were developed.
As these gates use both P-channel and N-channel MOSFET's as their input device, at quiescent conditions with no switching, the power consumption of CMOS gates is almost zero, (1 to 2uA) making them ideal for use in low-power battery circuits and with switching speeds upwards of 100MHz for use in high frequency timing and computer circuits.


2-input NAND gate
This CMOS gate example contains 3 N-channel MOSFET's, one for each input FET1 and FET2 and one for the output FET3. When both the inputs A and B are at logic level "0", FET1 and FET2 are both switched "OFF" giving an output logic "1" from the source of FET3. When one or both of the inputs are at logic level "1" current flows through the corresponding FET giving an output state at Q equivalent to logic "0", thus producing a NAND gate function.
Improvements in the circuit design with regards to switching speed, low power consumption and improved propagation delays has resulted in the standard CMOS 4000 "CD" family of logic IC's being developed that complement the TTL range. As with the standard TTL digital logic gates, all the major digital logic gates and devices are available in the CMOS package such as the CD4011, a Quad 2-input NANDgate, or the CD4001, a Quad 2-input NOR gate along with all their sub-families.
Like TTL logic, complementary MOS (CMOS) circuits take advantage of the fact that both N-channel and P-channel devices can be fabricated on the same substrate and connected together to form logic functions. One main disadvantage with the CMOS range of IC's compared to their equivalent TTL types is that they are easily damaged by static electricity so extra care must be taken when handling these devices. Also unlike TTL logic gates that operate on single +5V voltages for both their input and output levels, CMOS digital logic gates operate on a single supply voltage of between +3 and +18 volts.

The Logic "AND" Gate

Definition

Logic AND Gate is a type of digital logic gate that has an output which is normally at logic level "0" and only goes "HIGH" to a logic level "1" when ALL of its inputs are at logic level "1". The output of a Logic AND Gate only returns "LOW" again when ANY of its inputs are at a logic level "0". The logic or Boolean expression given for a logic AND gate is that for Logical Multiplication which is denoted by a single dot or full stop symbol, (.) giving us the Boolean expression of:  A.B = Q.
Then we can define the operation of a 2-input logic AND gate as being:
"If both A and B are true, then Q is true"

2-input Transistor AND Gate

A simple 2-input logic AND gate can be constructed using RTL Resistor-transistor switches connected together as shown below with the inputs connected directly to the transistor bases. Both transistors must be saturated "ON" for an output at Q.



Logic AND Gates are available using digital circuits to produce the desired logical function and is given a symbol whose shape represents the logical operation of the AND gate.

The Digital Logic "AND" Gate

2-input AND Gate

SymbolTruth Table


2-input AND Gate
BAQ
000
010
100
111
Boolean Expression Q = A.BRead as A AND B gives Q

3-input AND Gate

SymbolTruth Table
3-input AND gate
3-input AND Gate
CBAQ
0000
0010
0100
0110
1000
1010
1100
1111
Boolean Expression Q = A.B.CRead as A AND B AND C gives Q
Because the Boolean expression for the logic AND function is defined as (.), which is a binary operation, AND gates can be cascaded together to form any number of individual inputs. However, commercial available AND gate IC's are only available in standard 2, 3, or 4-input packages. If additional inputs are required, then standard AND gates will need to be cascaded together to obtain the required input value, for example.

The Boolean Expression for this 6-input AND gate will therefore be:   Q = (A.B).(C.D).(E.F)
If the number of inputs required is an odd number of inputs any "unused" inputs can be held HIGH by connecting them directly to the power supply using suitable "Pull-up" resistors.
Commonly available digital logic AND gate IC's include:
  TTL Logic Types
  •  
  • 74LS08 Quad 2-input
  • 74LS11 Triple 3-input
  • 74LS21 Dual 4-input
  CMOS Logic Types
  •  
  • CD4081 Quad 2-input
  • CD4073 Triple 3-input
  • CD4082 Dual 4-input

Quad 2-input AND Gate 7408


In the next tutorial about Digital Logic Gates, we will look at the digital logic OR Gate function as used in both TTL and CMOS logic circuits as well as its Boolean Algebra definition and truth tables.

The Logic "OR" Gate

Definition

Logic OR Gate or Inclusive-OR gate is a type of digital logic gate that has an output which is normally at logic level "0" and only goes "HIGH" to a logic level "1" when ANY of its inputs are at logic level "1". The output of a Logic OR Gate only returns "LOW" again when ALL of its inputs are at a logic level "0". The logic or Boolean expression given for a logic OR gate is that for Logical Addition which is denoted by a plus sign, (+) giving us the Boolean expression of:  A+B = Q.
Then we can define the operation of a 2-input logic OR gate as being:
"If either A or B is true, then Q is true"

2-input Transistor OR Gate

A simple 2-input logic OR gate can be constructed using RTL Resistor-transistor switches connected together as shown below with the inputs connected directly to the transistor bases. Either transistor must be saturated "ON" for an output at Q.

Logic OR Gates are available using digital circuits to produce the desired logical function and is given a symbol whose shape represents the logical operation of the OR gate.

The Digital Logic "OR" Gate

2-input OR Gate

SymbolTruth Table


2-input OR Gate
BAQ
000
011
101
111
Boolean Expression Q = A+BRead as A OR B gives Q

3-input OR Gate

SymbolTruth Table


3-input OR Gate
CBAQ
0000
0011
0101
0111
1001
1011
1101
1111
Boolean Expression Q = A+B+CRead as A OR B OR C gives Q
The OR function can have any number of individual inputs. However, commercial available OR gates are available in 2, 3, or 4 inputs types. Additional inputs will require gates to be cascaded together for example.

The Boolean Expression for this 6-input OR gate will therefore be:   Q = (A+B)+(C+D)+(E+F)
If the number of inputs required is an odd number of inputs any "unused" inputs can be held LOW by connecting them directly to ground using suitable "Pull-down" resistors.
Commonly available OR gate IC's include:
  TTL Logic Types
  •  
  • 74LS32 Quad 2-input
  CMOS Logic Types
  •  
  • CD4071 Quad 2-input
  • CD4075 Triple 3-input
  • CD4072 Dual 4-input

Quad 2-input OR Gate 7432



The Digital Logic "NOT" Gate

Definition

The digital Logic NOT Gate is the most basic of all the logical gates and is sometimes referred to as an Inverting Buffer or simply a Digital Inverter. It is a single input device which has an output level that is normally at logic level "1" and goes "LOW" to a logic level "0" when its single input is at logic level "1", in other words it "inverts" (complements) its input signal. The output from a NOT gate only returns "HIGH" again when its input is at logic level "0" giving us the Boolean expression of:  A = Q.
Then we can define the operation of a single input logic NOT gate as being:
"If A is NOT true, then Q is true"

Transistor NOT Gate

A simple 2-input logic NOT gate can be constructed using a RTL Resistor-transistor switches as shown below with the input connected directly to the transistor base. The transistor must be saturated "ON" for an inversed output "OFF" at Q.

Logic NOT Gates are available using digital circuits to produce the desired logical function. The standard NOT gate is given a symbol whose shape is of a triangle pointing to the right with a circle at its end. This circle is known as an "inversion bubble" and is used in NOTNAND and NOR symbols at their output to represent the logical operation of the NOT function. This bubble denotes a signal inversion (complementation) of the signal and can be present on either or both the output and/or the input terminals.

The Digital Inverter or NOT gate

SymbolTruth Table


Inverter or NOT Gate
AQ
01
10
Boolean Expression Q = not A or ARead as inverse of A gives Q
Logic NOT gates provide the complement of their input signal and are so called because when their input signal is "HIGH" their output state will NOT be "HIGH". Likewise, when their input signal is "LOW" their output state will NOT be "LOW". As they are single input devices, logic NOT gates are not normally classed as "decision" making devices or even as a gate, such as the AND or OR gates which have two or more logic inputs. Commercial available NOT gates IC's are available in either 4 or 6 individual gates within a single i.c. package.
The "bubble" (o) present at the end of the NOT gate symbol above denotes a signal inversion (complimentation) of the output signal. But this bubble can also be present at the gates input to indicate an active-LOW input. This inversion of the input signal is not restricted to the NOT gate only but can be used on any digital circuit or gate as shown with the operation of inversion being exactly the same whether on the input or output terminal. The easiest way is to think of the bubble as simply an inverter.

Signal Inversion using Active-low input Bubble



Bubble Notation for Input Inversion

NAND and NOR Gate Equivalents

An Inverter or logic NOT gate can also be made using standard NAND and NOR gates by connecting together ALL their inputs to a common input signal for example.


Also a very simple inverter can also be made using just a single stage transistor switching circuit as shown. When the transistors base input at "A" is high, the transistor conducts and collector current flows producing a voltage drop across the resistor R thereby connecting the output point at "Q" to ground thus resulting in a zero voltage output at "Q". When the transistors base input at "A" is low, the transistor now switches "OFF" and no collector current flows through the resistor resulting in an output voltage at "Q" high at a value near to +Vcc.
Then, with an input voltage at "A" HIGH, the output at "Q" will be LOW and an input voltage at "A" LOW the resulting output voltage at "Q" is HIGH producing the complement of the input signal.

Hex Schmitt Inverters

A standard Inverter or Logic NOT Gate, is usually made up from transistor switching circuits that do not switch from one state to the next instantly, there is some delay. Also as a transistor is a basic current amplifier, it can also operate in a linear mode and any small variation to its input level will cause a variation to its output level or may even switch "ON" and "OFF" several times if there is any noise present in the circuit. One way to overcome these problems is to use a Schmitt Inverter or Hex Inverter.
We know from the previous pages that all digital gates use only two logic voltage states and that these are generally referred to as Logic "1" and Logic "0" any TTL voltage input between 2.0v and 5v is recognised as a logic "1" and any voltage input below 0.8v is recognised as a logic "0" respectively. ASchmitt Inverter is designed to operate or switch state when its input signal goes above an "Upper Threshold Voltage" limit in which case the output changes and goes "LOW", and will remain in that state until the input signal falls below the "Lower Threshold Voltage" level in which case the output signal goes "HIGH". In other words a Schmitt Inverter has some form of Hysteresis built into its switching circuit. This switching action between an upper and lower threshold limit provides a much cleaner and faster "ON/OFF" switching output signal and makes the Schmitt inverter ideal for switching any slow-rising or slow-falling input signal either an analogue or digital signal.

Schmitt Inverter


A very useful application of Schmitt inverters is when they are used as oscillators or sine-to-square wave converters for use as square wave clock signals.

Schmitt Inverter Oscillator & Converter


The first circuit shows a very simple low power RC type oscillator using a Schmitt inverter to generate square waves. Initially the capacitor C is fully discharged so the input to the inverter is "LOW" resulting in an inverted output which is "HIGH". As the output from the inverter is fed back to its input and the capacitor via the resistor R the capacitor begins to charge up. When the capacitors charging voltage reaches the upper threshold limit of the inverter, the inverter changes state, the output becomes "LOW" and the capacitor begins to discharge through the resistor until it reaches the lower threshold level were the inverter changes state again. This switching back and forth by the inverter produces a square wave output signal with a 33% duty cycle and whose frequency is given as: ƒ = 680/RC.
The second circuit converts a sine wave input (or any oscillating input for that matter) into a square wave output. The input to the inverter is connected to the junction of the potential divider network which is used to set the quiescent point of the circuit. The input capacitor blocks any DC component present in the input signal only allowing the sine wave signal to pass. As this signal passes the upper and lower threshold points of the inverter the output also changes from "HIGH" to "LOW" and so on producing a square wave output waveform. This circuit produces an output pulse on the positive rising edge of the input waveform, but by connecting a second Schmitt inverter to the output of the first, the basic circuit can be modified to produce an output pulse on the negative falling edge of the input signal.
Commonly available logic NOT gate and Inverter IC's include
  TTL Logic Types
  •  
  • 74LS04 Hex Inverting NOT Gate
  • 74LS04 Hex Inverting NOT Gate
  • 74LS14 Hex Schmitt Inverting NOT Gate
  • 74LS1004 Hex Inverting Drivers
  CMOS Logic Types
  •  
  • CD4009 Hex Inverting NOT Gate
  • CD4069 Hex Inverting NOT Gate

Inverter or NOT Gate 7404



The Logic "NAND" Gate

Definition

The Logic NAND Gate is a combination of the digital logic AND gate with that of an inverter or NOT gate connected together in series. The NAND (Not - AND) gate has an output that is normally at logic level "1" and only goes "LOW" to logic level "0" when ALL of its inputs are at logic level "1". The Logic NAND Gate is the reverse or "Complementary" form of the AND gate we have seen previously.

Logic NAND Gate Equivalence


The logic or Boolean expression given for a logic NAND gate is that for Logical Addition, which is the opposite to the AND gate, and which it performs on the complements of the inputs. The Boolean expression for a logic NAND gate is denoted by a single dot or full stop symbol, (.) with a line orOverline, ( ‾‾ ) over the expression to signify the NOT or logical negation of the NAND gate giving us the Boolean expression of:  A.B = Q.
Then we can define the operation of a 2-input logic NAND gate as being:
"If either A or B are NOT true, then Q is true"

Transistor NAND Gate

A simple 2-input logic NAND gate can be constructed using RTL Resistor-transistor switches connected together as shown below with the inputs connected directly to the transistor bases. Either transistor must be cut-off "OFF" for an output at Q.

Logic NAND Gates are available using digital circuits to produce the desired logical function and is given a symbol whose shape is that of a standard AND gate with a circle, sometimes called an "inversion bubble" at its output to represent the NOT gate symbol with the logical operation of the NANDgate given as.

The Digital Logic "NAND" Gate

2-input NAND Gate

SymbolTruth Table


2-input NAND Gate
BAQ
001
011
101
110
Boolean Expression Q = A.BRead as A AND B gives NOT Q

3-input NAND Gate

SymbolTruth Table


3-input NAND Gate
CBAQ
0001
0011
0101
0111
1001
1011
1101
1110
Boolean Expression Q = A.B.CRead as A AND B AND C gives NOT Q
As with the AND function seen previously, the NAND function can also have any number of individual inputs and commercial available NAND Gate i.c.´s are available in standard 2, 3, or 4 input types. If additional inputs are required, then the standard NAND gates can be cascaded together to provide more inputs for example.

A 4-input NAND Function


The Boolean Expression for this 4-input logic NAND gate will therefore be:   Q = A.B.C.D
If the number of inputs required is an odd number of inputs any "unused" inputs can be held HIGH by connecting them directly to the power supply using suitable "Pull-up" resistors.
The Logic NAND Gate function is sometimes known as the Sheffer Stroke Function and is denoted by a vertical bar or upwards arrow operator, for example, A NAND B = A|B or AB.

The "Universal" NAND Gate

The Logic NAND Gate is generally classed as a "Universal" gate because it is one of the most commonly used logic gate types. NAND gates can also be used to produce any other type of logic gate function, and in practice the NAND gate forms the basis of most practical logic circuits. By connecting them together in various combinations the three basic gate types of ANDOR and NOT function can be formed using only NAND's, for example.

Various Logic Gates using only NAND Gates


As well as the three common types above, Ex-OrEx-Nor and standard NOR gates can be formed using just individual NAND gates.
Commonly available logic NAND gate IC's include:
  TTL Logic Types
  •  
  • 74LS00 Quad 2-input
  • 74LS10 Triple 3-input
  • 74LS20 Dual 4-input
  • 74LS30 Single 8-input
  CMOS Logic Types
  •  
  • CD4011 Quad 2-input
  • CD4023 Triple 3-input
  • CD4012 Dual 4-input

Quad 2-input NAND Gate 7400



The Logic "NOR" Gate

Definition

The Logic NOR Gate or Inclusive-NOR gate is a combination of the digital logic OR gate with that of an inverter or NOT gate connected together in series. The NOR (Not - OR) gate has an output that is normally at logic level "1" and only goes "LOW" to logic level "0" when ANY of its inputs are at logic level "1". The Logic NOR Gate is the reverse or "Complementary" form of the OR gate we have seen previously.

NOR Gate Equivalent


The logic or Boolean expression given for a logic NOR gate is that for Logical Multiplication which it performs on the complements of the inputs. The Boolean expression for a logic NOR gate is denoted by a plus sign, (+) with a line or Overline, ( ‾‾ ) over the expression to signify the NOT or logical negation of the NOR gate giving us the Boolean expression of:  A+B = Q.
Then we can define the operation of a 2-input logic NOR gate as being:
"If both A and B are NOT true, then Q is true"

Transistor NOR Gate

A simple 2-input logic NOR gate can be constructed using RTL Resistor-transistor switches connected together as shown below with the inputs connected directly to the transistor bases. Both transistors must be cut-off "OFF" for an output at Q.

Logic NOR Gates are available using digital circuits to produce the desired logical function and is given a symbol whose shape is that of a standard OR gate with a circle, sometimes called an "inversion bubble" at its output to represent the NOT gate symbol with the logical operation of the NOR gate given as.

The Digital Logic "NOR" Gate

2-input NOR Gate

SymbolTruth Table


2-input NOR Gate
BAQ
001
010
100
110
Boolean Expression Q = A+BRead as A OR B gives NOT Q

3-input NOR Gate

SymbolTruth Table


3-input NOR Gate
CBAQ
0001
0010
0100
0110
1000
1010
1100
1110
Boolean Expression Q = A+B+CRead as A OR B OR C gives NOT Q
As with the OR function, the NOR function can also have any number of individual inputs and commercial available NOR Gate IC's are available in standard 2, 3, or 4 input types. If additional inputs are required, then the standard NOR gates can be cascaded together to provide more inputs for example.

A 4-input NOR Function


The Boolean Expression for this 4-input NOR gate will therefore be:   Q = A+B+C+D
If the number of inputs required is an odd number of inputs any "unused" inputs can be held LOW by connecting them directly to ground using suitable "Pull-down" resistors.
The Logic NOR Gate function is sometimes known as the Pierce Function and is denoted by a downwards arrow operator as shown, AB.

The "Universal" NOR Gate

Like the NAND gate seen in the last section, the NOR gate can also be classed as a "Universal" type gate. NOR gates can be used to produce any other type of logic gate function just like the NAND gate and by connecting them together in various combinations the three basic gate types of ANDOR andNOT function can be formed using only NOR's, for example.

Various Logic Gates using only NOR Gates


As well as the three common types above, Ex-OrEx-Nor and standard NOR gates can also be formed using just individual NOR gates.
Commonly available NOR gate IC's include:
  TTL Logic Types
  •  
  • 74LS02 Quad 2-input
  • 74LS27 Triple 3-input
  • 74LS260 Dual 4-input
  CMOS Logic Types
  •  
  • CD4001 Quad 2-input
  • CD4025 Triple 3-input
  • CD4002 Dual 4-input

Quad 2-input NOR Gate 7402


In the next tutorial about Digital Logic Gates, we will look at the digital logic Exclusive-OR gate known commonly as the Ex-OR Gate function as used in both TTL and CMOS logic circuits as well as its Boolean Algebra definition and truth tables.

The Exclusive-OR Gate

Definition

Previously, we have seen that for a 2-input OR gate, if A = "1"OR B = "1"OR BOTH A + B = "1" then the output from the gate is also at logic level "1" and this is known as an Inclusive-OR function because it includes the case of Q = "1" when both A and B = "1". If however, an output "1" is obtained ONLY whenA = "1" or when B = "1" but NOT both together at the same time, then this type of gate is known as anExclusive-OR function or an Ex-Or function for short because it excludes the "OR BOTH" case of Q = "1" when both A and B = "1".
In other words the output of an Exclusive-OR gate ONLY goes "HIGH" when its two input terminals are at "DIFFERENT" logic levels with respect to each other and they can both be at logic level "1" or both at logic level "0" giving us the Boolean expression of:  Q = (A     B) = A.B + A.B
The Exclusive-OR Gate function is achieved is achieved by combining standard gates together to form more complex gate functions. An example of a 2-input Exclusive-OR gate is given below.

The Digital Logic "Ex-OR" Gate

2-input Ex-OR Gate

SymbolTruth Table


2-input Ex-OR Gate
BAQ
000
011
101
110
Boolean Expression Q = A     BRead as A OR B but NOT BOTH gives Q
Then, the logic function implemented by a 2-input Ex-OR is given as "either A OR B but NOT both" will give an output at Q. In general, an Ex-OR gate will give an output value of logic "1" ONLY when there are an ODD number of 1's on the inputs to the gate. Then an Ex-OR function with more than two inputs is called an "odd function" or modulo-2-sum (Mod-2-SUM), not an Ex-OR. This description can be expanded to apply to any number of individual inputs as shown below for a 3-input Ex-OR gate.

3-input Ex-OR Gate

SymbolTruth Table


3-input Ex-OR Gate
CBAQ
0000
0011
0101
0110
1001
1010
1100
1111
Boolean Expression Q = A     B     CRead as "any ODD number of Inputs" gives Q

The symbol used to denote an Exclusive-OR function is slightly different to that for the standardInclusive-OR gate. The logic or Boolean expression given for a logic OR gate is that of logical addition which is denoted by a standard plus sign. The symbol used to describe the Boolean expression for anExclusive-OR function is a plus sign, ( + ) within a circle, ( Ο ). This exclusive-OR symbol also represents the mathematical "direct sum of sub-objects" expression, with the resulting symbol for anExclusive-OR function being given as: (      ).
We said previously that the Ex-OR function is a combination of different basic logic gates and using the 2-input truth table above, we can expand the Ex-OR function to: Q = (A      B) = (A+B).(A.B) which means we can realise this new expression using the following individual gates.

Ex-OR Gate Equivalent Circuit



Ex-OR Function Realisation using NAND gatesOne of the main disadvantages of implementing the Ex-OR function above is that it contains three different types logic gates ORNAND and finally AND within its design. One easier way of producing theEx-OR function from a single gate is to use our old favourite the NAND gate as shown below.

Commonly available 
Exclusive-OR gate IC's include:Exclusive-OR Gates are used mainly to build circuits that perform arithmetic operations and calculations especially Adders and Half-Adders as they can provide a "carry-bit" function or as a controlled inverter, where one input passes the binary data and the other input is supplied with a control signal.
  TTL Logic Types
  •  
  • 74LS86 Quad 2-input
  CMOS Logic Types
  •  
  • CD4030 Quad 2-input

Quad 2-input Ex-OR Gate 7486


In the next tutorial about Digital Logic Gates, we will look at the digital logic Exclusive-NOR gate known commonly as the Ex-NOR Gate function as used in both TTL and CMOS logic circuits as well as its Boolean Algebra definition and truth tables.

The Exclusive-NOR Gate

Definition

The Exclusive-NOR Gate function or Ex-NOR for short, is a digital logic gate that is the reverse or complementary form of the Exclusive-OR function we look at in the previous section. It is a combination of the Exclusive-OR gate and the NOT gate but has a truth table similar to the standard NOR gate in that it has an output that is normally at logic level "1" and goes "LOW" to logic level "0" when ANY of its inputs are at logic level "1". However, an output "1" is also obtained if BOTH of its inputs are at logic level "1". For example, A = "1" and B = "1" at the same time giving us the Boolean expression of:  Q = (    B) = A.B + A.B
In other words, the output of an Exclusive-NOR gate ONLY goes "HIGH" when its two input terminals, Aand B are at the "SAME" logic level which can be either at a logic level "1" or at a logic level "0". Then this type of gate gives and output "1" when its inputs are "logically equal" or "equivalent" to each other, which is why an Exclusive-NOR gate is sometimes called an Equivalence Gate. The logic symbol for an Exclusive-NOR gate is simply an Exclusive-OR gate with a circle or "inversion bubble", ( ο ) at its output to represent the NOT function. Then the Logic Exclusive-NOR Gate is the reverse or "Complementary" form of the Exclusive-OR gate, (      ) we have seen previously.

Ex-NOR Gate Equivalent


The Exclusive-NOR Gate function is achieved by combining standard gates together to form more complex gate functions and an example of a 2-input Exclusive-NOR gate is given below.

The Digital Logic "Ex-NOR" Gate

2-input Ex-NOR Gate

SymbolTruth Table


2-input Ex-NOR Gate
BAQ
001
010
100
111
Boolean Expression Q =     BRead if A AND B the SAME gives Q
Then, the logic function implemented by a 2-input Ex-NOR gate is given as "when both A AND B are the SAME" will give an output at Q. In general, an Exclusive-NOR gate will give an output value of logic "1" ONLY when there are an EVEN number of 1's on the inputs to the gate (the inverse of the Ex-ORgate) except when all its inputs are "LOW". Then an Ex-NOR function with more than two inputs is called an "even function" or modulo-2-sum (Mod-2-SUM), not an Ex-NOR. This description can be expanded to apply to any number of individual inputs as shown below for a 3-input Exclusive-NOR gate.

3-input Ex-NOR Gate

SymbolTruth Table


3-input Ex-NOR Gate
CBAQ
0001
0010
0100
0111
1000
1011
1101
1110
Boolean Expression Q =     B     CRead as "any EVEN number of Inputs" gives Q
We said previously that the Ex-NOR function is a combination of different basic logic gates Ex-OR and a NOT gate, and by using the 2-input truth table above, we can expand the Ex-NOR function to:Q =     B = (A.B) + (A.B)  which means we can realise this new expression using the following individual gates.

Ex-NOR Gate Equivalent Circuit


Ex-NOR Function Realisation using NAND gates
One of the main disadvantages of implementing the Ex-NOR function above is that it contains three different types logic gates the ANDNOT and finally an OR gate within its basic design. One easier way of producing the Ex-NOR function from a single gate type is to use NAND gates as shown below.

Commonly available 
Exclusive-NOR gate IC's include:
Ex-NOR gates are used mainly in electronic circuits that perform arithmetic operations and data checking such as AddersSubtractors or Parity Checkers, etc. As the Ex-NOR gate gives an output of logic level "1" whenever its two inputs are equal it can be used to compare the magnitude of two binary digits or numbers and so Ex-NOR gates are used in Digital Comparator circuits.
  TTL Logic Types
  •  
  • 74LS266 Quad 2-input
  CMOS Logic Types
  •  
  • CD4077 Quad 2-input

Quad 2-input Ex-NOR Gate 74266


In the next tutorial about Digital Logic Gates, we will look at the digital Tri-state Buffer also called the non-inverting buffer as used in both TTL and CMOS logic circuits as well as its Boolean Algebra definition and truth table.

The Digital Tri-state Buffer

Definition

In a previous tutorial we look at the digital Not Gate or Inverter, and we saw that the NOT gates output is the "complement" or inverse of its input signal. For example, when its input signal is "HIGH" its output state will NOT be "HIGH" and when its input signal is "LOW" its output state will NOT be "LOW", in other words it inverts the signal. Another single input logical device used a lot in electronic circuits and which is the reverse of the NOT gate inverter is called a BufferDigital Buffer or Non-inverting Buffer.
Digital Buffer is another single input device that does no invert or perform any type of logical operation on its input signal as its output exactly matches that of its input signal. In other words, its Output equals its Input. It is a "Non-inverting" device and so will give us the Boolean expression of:  Q = A.
Then we can define the operation of a single input Digital Buffer as being:
"If A is true, then Q is true"

The Tri-state Buffer

SymbolTruth Table


A Tri-state Buffer
AQ
00
11
Boolean Expression Q = ARead as A gives Q
The Digital Tri-state Buffer can also be made by connecting together two NOT gates as shown below. The first will "invert" the input signal A and the second will "re-invert" it back to its original level.

Double Inversion using NOT Gates


You may think "what is the point of a Digital Buffer", if it does not alter its input signal in any way or make any logical operations like the AND or OR gates, then why not use a piece of wire instead and that's a good point. But a non-inverting digital Buffer has many uses in digital electronic circuits, as they can be used to isolate other gates or circuits from each other or they can be used to drive high current loads such as transistor switches because their output drive capability is much higher than their input signal requirements, in other words buffers are uses for power amplification giving them a high fan-outcapability.

Buffer Fan-out Example


Fan-out is the output driving capability or output current capability of a logic gate giving greater power amplification of the signal. It may be necessary to connect more than just one logic gate to the output of another or to switch a high current load such as an LED, then a Buffer will allow us to do just that by having a high fan-out rating of up to 50.

The "Tri-state Buffer"

As well as the standard Digital Buffer seen above, there is another type of digital Buffer circuit whose output can be "electronically" disconnected from its output circuitry when required. This type of Buffer is known as a 3-State Buffer or commonly Tri-state Buffer.
Tri-state Buffer can be thought of as an input controlled switch which has an output that can be electronically turned "ON" or "OFF" by means of an external "Control" or "Enable" signal input. This control signal can be either a logic "0" or a logic "1" type signal resulting in the Tri-state Buffer being in one state allowing its output to operate normally giving either a logic "0" or logic "1" output. But when activated in the other state it disables or turns "OFF" its output producing an open circuit condition that is neither "High" or "low", but instead gives an output state of very high impedance, high-Z, or more commonly Hi-Z. Then this type of device has two logic state inputs, "0" or a "1" but can produce three different output states, "0", "1" or "Hi-Z" which is why it is called a "3-state" device.
There are two different types of Tri-state Buffer, one whose output is controlled by an "Active-HIGH" control signal and the other which is controlled by an "Active-LOW" control signal, as shown below.

Active "HIGH" Tri-state Buffer

SymbolTruth Table


Tri-state Buffer
EnableAQ
100
111
00Hi-Z
01Hi-Z
Read as Output = Input if Enable is equal to "1"
An Active-high Tri-state Buffer is activated when a logic level "1" is applied to its "enable" control line and the data passes through from its input to its output. When the enable control line is at logic level "0", the buffer output is disabled and a high impedance condition, Hi-Z is present on the output.

Active "LOW" Tri-state Buffer

SymbolTruth Table


Tri-state Buffer
EnableAQ
000
011
10Hi-Z
11Hi-Z
Read as Output = Input if Enable is NOT equal to "1"
An Active-low Tri-state Buffer is the opposite to the above, and is activated when a logic level "0" is applied to its "enable" control line. The data passes through from its input to its output. When the enable control line is at logic level "1", the buffer output is disabled and a high impedance condition, Hi-Z is present on the output.

Tri-state Buffer Control

The Tri-state Buffer is used in many electronic and microprocessor circuits as they allow multiple logic devices to be connected to the same wire or bus without damage or loss of data. For example, suppose we have a data line or data bus with some memory, peripherals, I/O or a CPU connected to it. Each of these devices is capable of sending or receiving data onto this data bus. If these devices start to send or receive data at the same time a short circuit may occur when one device outputs to the bus a logic "1" the supply voltage, while another is set at logic level "0" or ground, resulting in a short circuit condition and possibly damage to the devices.
Then, the Tri-state Buffer can be used to isolate devices and circuits from the data bus and one another. If the outputs of several Tri-state Buffers are electrically connected together Decoders are used to allow only one Tri-state Buffer to be active at any one time while the other devices are in their high impedance state. An example of Tri-state Buffers connected to a single wire or bus is shown below.

Tri-state Buffer Control


It is also possible to connect Tri-state Buffer "back-to-back" to produce a Bi-directional Buffer circuit with one "active-high buffer" connected in parallel but in reverse with one "active-low buffer". Here, the "enable" control input acts more like a directional control signal causing the data to be both read "from" and transmitted "to" the same data bus wire.
Commonly available Digital Buffer and Tri-state Buffer IC's include:
  TTL Logic Types
  •  
  • 74LS07 Hex Non-inverting Buffer
  • 74LS17 Hex Buffer/Driver
  • 74LS244 Octal Buffer/Line Driver
  • 74LS245 Octal Bi-directional Buffer
  CMOS Logic Types
  •  
  • CD4050 Hex Non-inverting Buffer
  • CD4503 Hex Tri-state Buffer
  • HEF40244 Octal Buffer with 3-state Output

Digital Non-inverting Buffer 7407


Octal Tri-state Buffer 74244

In the next tutorial about Digital Logic Gates, we will look at the digital Logic OR Gate function as used in both TTL and CMOS logic circuits as well as its Boolean Algebra definition and truth tables.

Digital Logic Gates Summary

In this section about Digital Logic Gates, we have seen that there are three main basic types of digital logic gate, the AND Gate , the OR Gate and the NOT Gate. We have also seen that each gate has an opposite or complementary form of itself in the form of the NAND Gate, the NOR Gate and the Bufferrespectively, and that any of these individual gates can be connected together to form more complexCombinational Logic circuits.
We have also seen, that both the NAND gate and the NOR gate can both be classed as "Universal" gates as they can be used to construct any other gate type. In fact, any combinational circuit can be constructed using only two or three input NAND or NOR gates. We also saw that NOT gates andBuffers are single input devices that can also have a Tri-state High-impedance output which can be used to control the flow of data onto a common data bus wire.
Digital Logic Gates can be made from discrete components such as ResistorsTransistors andDiodes to form RTL (resistor-transistor logic) or DTL (diode-transistor logic) circuits, but today's modern digital 74xxx series integrated circuits are manufactured using TTL (transistor-transistor logic) based on NPN bipolar transistor technology or the much faster and low power CMOS MOSFET transistor logic used in the 74Cxxx, 74HCxxx, 74ACxxx and the 4000 series logic chips.
The eight most "standard" individual Digital Logic Gates are summarised below along with their corresponding truth tables.

The Logic AND Gate

SymbolTruth Table

BAQ
000
010
100
111
Boolean Expression Q = A . BRead as A AND B gives Q


The Logic NAND Gate

SymbolTruth Table

BAQ
001
011
101
110
Boolean Expression Q = A . BRead as A AND B gives NOT Q


The Logic OR Gate

SymbolTruth Table
BAQ
000
011
101
111
Boolean Expression Q = A + BRead as A OR B gives Q


The Logic NOR Gate

SymbolTruth Table
BAQ
001
010
100
110
Boolean Expression Q = A + BRead as A OR B gives NOT Q


The Logic Exclusive-OR Gate (Ex-OR)

SymbolTruth Table
BAQ
000
011
101
110
Boolean Expression Q = A     BRead as A OR B but not BOTH gives Q


The Logic Exclusive-NOR Gate (Ex-NOR)

SymbolTruth Table
p
BAQ
001
010
100
111
Boolean Expression Q =     BRead if A AND B the SAME gives Q


The Buffer

SymbolTruth Table
AQ
00
11
Boolean Expression Q = ARead as A gives Q


The NOT gate (Inverter)

SymbolTruth Table
p
AQ
01
10
Boolean Expression Q = not A or ARead as inverse of A gives Q

The operation of the above Digital Logic Gates and their Boolean expressions can be summerised into a single truth table as shown below. This truth table shows the relationship between each output of the main digital logic gates for each possible input combination.


Truth Table Summary

InputsTruth Table Outputs for 2-input Logic Gates
BAANDNANDORNOREX-OREX-NOR
00010101
01011010
10011010
11101001

Truth Table Output for Single-input Gates
ANOTBuffer
010
101

Pull-up and Pull-down Resistors

One final point to remember, when connecting together digital logic gates to produce logic circuits, any "unused" inputs to the gates must be connected directly to either a logic level "1" or a logic level "0" by means of a suitable "Pull-up" or "Pull-down" resistor ( for example 1kΩ resistor ) to produce a fixed logic signal. This will prevent the unused input to the gate from "floating" about and producing false switching of the gate and circuit.