CircuitNote

Quick electronics calculators for lab work and circuit design. Free, no sign-up, works in your browser.

Building AND, OR and NOT from NAND or NOR gates (measured)

Output voltages of gates built from a 7400 and a 7402, checked against logic level limits.

NAND and NOR are "universal" gates: either one alone can make AND, OR and NOT. These are real measurements from circuits built with a 7400 (NAND) and a 7402 (NOR), switching the inputs between 0 V and 5 V and reading the output on a multimeter.

In this guide 5

1. How to wire them

CircuitGatesWiring
CircuitNAND → NOTGates1 gateWiringNAND(A, A)
CircuitNAND → ANDGates2 gatesWiringNAND(NAND(A, B), NAND(A, B))
CircuitNAND → ORGates3 gatesWiringNAND(NAND(A, A), NAND(B, B))
CircuitNOR → NOTGates1 gateWiringNOR(A, A)
CircuitNOR → ORGates2 gatesWiringNOR(NOR(A, B), NOR(A, B))
CircuitNOR → ANDGates3 gatesWiringNOR(NOR(A, A), NOR(B, B))

Every wiring in the table is checked in code against all four input combinations. AND is simplest from NAND and OR is simplest from NOR, at two gates each; the other way round takes three.

2. Measurements

CircuitInputMeasured outputExpectedMatch
CircuitNAND → ANDInput00Measured output−1.68 mVExpected0✓
CircuitNAND → ANDInput01Measured output0.01 mVExpected0✓
CircuitNAND → ANDInput10Measured output0.01 mVExpected0✓
CircuitNAND → ANDInput11Measured output4.9774 VExpected1✓
CircuitNAND → ORInput00Measured output0.11 mVExpected0✓
CircuitNAND → ORInput01Measured output4.9956 VExpected1✓
CircuitNAND → ORInput10Measured output4.9590 VExpected1✓
CircuitNAND → ORInput11Measured output4.9873 VExpected1✓
CircuitNAND → NOTInput0Measured output4.9254 VExpected1✓
CircuitNAND → NOTInput1Measured output0.00 mVExpected0✓
CircuitNOR → ANDInput00Measured output−0.16 mVExpected0✓
CircuitNOR → ANDInput01Measured output0.12 mVExpected0✓
CircuitNOR → ANDInput10Measured output−0.28 mVExpected0✓
CircuitNOR → ANDInput11Measured output4.9557 VExpected1✓
CircuitNOR → ORInput00Measured output9.96 mVExpected0✓
CircuitNOR → ORInput01Measured output4.8822 VExpected1✓
CircuitNOR → ORInput10Measured output4.8852 VExpected1✓
CircuitNOR → ORInput11Measured output4.8847 VExpected1✓
CircuitNOR → NOTInput0Measured output4.9125 VExpected1✓
CircuitNOR → NOTInput1Measured output9.75 mVExpected0✓

Reading anything at or below 0.8 V as 0 and at or above 2.0 V as 1 (74LS limits), all 20 readings match. High outputs were 4.88 to 5.00 V and Low outputs −1.68 mV to 9.96 mV, far inside the output limits (High ≥ 2.7 V, Low ≤ 0.5 V). Nothing else was connected to the outputs, so the values are close to ideal.

Try it: wire a universal gate

Pick a construction and press the input switches. Wire colour shows the logic value (1 coloured, 0 grey); the measured output comes from the table above.

Inputs

Output Y
0
Textbook value
0
Gates
2
Measured output
−1.68 mV
Read by a 74LS input
Low (0)

Things to try: OR from NANDs takes three gates, from NORs only two. Step through the inputs and check every measured voltage reads as the textbook value.

3. Switching threshold

Driving the input with a slowly changing voltage and overlaying input and output on an oscilloscope, the output switched at about 1.5 V. That has to lie between the Low limit of 0.8 V and the High limit of 2.0 V, and it does. The datasheet leaves this band undefined because the threshold varies a little from chip to chip and with temperature.

4. When a square wave looks tilted on the scope

During the lab the square wave input looked tilted instead of flat. The usual cause is the channel being set to AC coupling. AC coupling is a high-pass filter that blocks DC, so the flat tops sag toward 0 V over time. Assuming a 10 Hz coupling corner, the sag is:

Square wave frequencySag over each half-cycle
50 Hz46.7%
100 Hz27.0%
500 Hz6.1%
1 kHz3.1%
10 kHz0.3%

Logic waveforms depend on their DC level, so switch the channel to DC coupling. A probe that is out of compensation (adjusted with the screw while touching the scope's calibration terminal) also makes the corners look rounded or spiky.

5. In your lab report

  • State which limits you used to turn voltages into 0 and 1, for example 0.8 V and 2.0 V for 74LS.
  • If you changed inputs by plugging jumpers in and out rather than with switches, make sure a 0 input went to GND rather than being left floating.

For multi-bit circuits, get the expected values first with the number base converter and the 4-bit ALU calculator.