Associate CET · Competency 13.0

Digital Electronics

Competency 13.0 covers the circuits that work in ones and zeros: gates and truth tables, logic families and their voltages, clocks, flip-flops, counters, the bus, displays and microcontrollers, and the probe, pulser and method a technician uses to find a digital fault. This page teaches each of ETA's twelve sub-items once, with section 13 as job practice. Boolean algebra and number systems are in the Mathematics guide; the Digital / Logic tool, the Logic Gates explorer and the Binary Converter do the drilling.

Competency
13.0
Sections
13 + self-check
Then
Drill comp 13

Gates and other logic devices

Competency 13.1 asks you to identify each of the basic digital gates and devices. A logic gate takes inputs that are each high (1) or low (0) and produces one output by a fixed rule. Kuphaldt: a gate is a special amplifier built to accept and produce only those two levels, and the small circle, or bubble, on a symbol always means inversion. A triangle with no bubble is a buffer, which passes the signal through unchanged. The seven gates, with the Boolean notation of section 5 of the Mathematics guide (A' is NOT A):

GateBooleanOutput is 1 when
ANDY = ABevery input is 1
ORY = A + Bany input is 1
NOT (inverter)Y = A'its one input is 0
NANDY = (AB)'any input is 0
NORY = (A + B)'every input is 0
XORY = AB' + A'Bthe two inputs differ
XNORY = AB + A'B'the two inputs are the same

Kuphaldt: NAND and NOR are universal, because enough of either can be wired to mimic any other gate. TI's SN74LS00 datasheet gives both forms for its four NAND gates: each performs Y = (AB)', which is also A' + B', in positive logic. Two more gate types matter on real boards. A Schmitt trigger input has two thresholds, one for a rising and one for a falling signal, and that hysteresis gives it extra immunity to noise. A tristate output has a third state besides high and low: with its enable input off it floats in a high-impedance (high-Z) state, as if disconnected, which is how several outputs share one bus line (section 7).

Devices built from gates. Kuphaldt's combinational-logic chapter names the common ones: a decoder turns an n-bit code into one of 2n output lines; an encoder does the reverse; a multiplexer (mux) selects one of several inputs onto one output; a demultiplexer sends one input to one of several outputs; and a half adder adds two bits, its sum being an XOR and its carry an AND. These are combinational: the output depends only on the present inputs, whereas the sequential circuits of sections 5 and 6 also depend on what happened before.

Worked example

Selecting one of sixteen devices: Kuphaldt's line-decoder example. A circuit that must select one of 16 devices could run 16 separate control lines. A 4-line decoder does it with four, because 24 = 16: each 4-bit code on its inputs drives exactly one of its 16 outputs. A 3-to-8 decoder works the same way with 23 = 8 outputs.

Trap

Exam trap: a NAND is not an AND gate with inverted inputs. By DeMorgan's theorem, an AND with inverted inputs is A'B' = (A + B)', which is a NOR; a NAND equals an OR with inverted inputs, (AB)' = A' + B'. Read the bubble's position: on the output it inverts the result, on the inputs it inverts each input.

The Logic Gates explorer draws every symbol and runs its truth table, and the Logic Gates lesson in the Study Hub works through the seven gates and why NAND is universal.

Truth tables

Competency 13.2 asks you to construct truth tables for common gates. A truth table lists every possible combination of the inputs and the output each one produces. With n inputs there are 2n combinations: 4 rows for two inputs, 8 for three and 16 for four. Count the rows in binary, 00, 01, 10, 11, so that no combination is missed. All six two-input gates on one table:

A BANDORNANDNORXORXNOR
0 0001101
0 1011010
1 0011010
1 1110001

Each inverted gate's column is the exact opposite of its partner's: NAND of AND, NOR of OR, XNOR of XOR. For a gate network, give each intermediate signal its own column and work left to right. For Y = (A + B)C', with three inputs and so 8 rows:

A B CA + BC'Y
0 0 0010
0 0 1000
0 1 0111
0 1 1100
1 0 0111
1 0 1100
1 1 0111
1 1 1100

Worked example

Reading the three-input table: Y = (A + B)C' is an OR gate feeding one input of an AND gate, with C through an inverter into the other. Y is 1 only when at least one of A and B is 1 and C is 0: rows 010, 100 and 110, three of the eight. With C at 1 the inverter holds the AND gate's input low, so every row with C = 1 gives Y = 0 whatever A and B do.

Trap

Exam trap: the number of rows doubles with each input; it does not go up by two. Three inputs need 23 = 8 rows, not 6, and four inputs need 16. A table that is short a row has left out a combination.

On the exam

Exam point: a truth table lists every combination of the inputs, so two inputs need 4 rows and three need 8; a NAND output is low only on the row where every input is high. NOR is the mirror case: high only on the row where every input is low.

The Digital / Logic tool's Boolean Expression Analyzer builds the truth table for any expression you type.

Logic families and voltage levels

Competency 13.11 asks you to explain voltages and logic families (TTL, CMOS). A family is a way of building gates, and each family defines its own voltage ranges for a valid low and a valid high. Kuphaldt: TTL gates are built from bipolar transistors and CMOS gates from MOSFETs. The manufacturer guarantees two pairs of limits: what an input will accept (VIL maximum for a low, VIH minimum for a high) and what an output will deliver (VOL maximum, VOH minimum). The values below are from TI's current datasheets for the SN7400, SN74LS00, SN74HC00 and SN74HCT00 quad NAND gates:

Family (TI part)SupplyInput low, highOutput low, high
Standard TTL (SN7400)4.75 to 5.25 V≤ 0.8 V, ≥ 2 V≤ 0.4 V at 16 mA, ≥ 2.4 V
Low-power Schottky TTL (SN74LS00)4.75 to 5.25 V≤ 0.8 V, ≥ 2 V≤ 0.5 V at 8 mA (0.4 V at 4 mA), ≥ 2.5 V
High-speed CMOS (SN74HC00) at 4.5 V2 to 6 V≤ 1.35 V, ≥ 3.15 V≤ 0.1 V, ≥ 4.4 V (light load)
CMOS with TTL inputs (SN74HCT00)4.5 to 5.5 V≤ 0.8 V, ≥ 2 VCMOS outputs

The gap between what an output guarantees and what an input needs is the noise margin: the most noise that can ride on a weak output before the next gate may misread it. The high margin is VOH minus VIH, and the low margin is VIL minus VOL.

Worked example

Noise margins: standard TTL (SN7400): high 2.4 − 2.0 = 0.4 V and low 0.8 − 0.4 = 0.4 V. LS TTL (SN74LS00 at 8 mA): high 2.5 − 2.0 = 0.5 V and low 0.8 − 0.5 = 0.3 V; with the older 2.7 V output figure, Kuphaldt gets 0.7 V high. CMOS at 5 V (Kuphaldt's figures): 4.95 − 3.5 = 1.45 V and 1.5 − 0.05 = 1.45 V, roughly double TTL's.

Worked example

TTL driving CMOS: an SN7400 output high is guaranteed only 2.4 V, but an SN74HC00 input on a 4.5 V supply needs at least 3.15 V. A valid TTL high can therefore sit in the CMOS input's undefined band. Kuphaldt's fix is a pull-up resistor on the TTL output; TI's is the HCT version, whose inputs accept TTL levels (high from 2 V). Going the other way, a 5 V CMOS output's levels suit a TTL input; Kuphaldt's one caveat is current, because the CMOS output must sink each TTL input's low-state current (up to 1.6 mA for an SN7400 input, 0.4 mA for an SN74LS00 input, per TI).

Trap

Exam trap: the two families treat an unconnected input differently. Kuphaldt: a floating TTL input is read as a high, but a floating CMOS input may settle at either level, so a CMOS input must never be left floating. TI adds that a CMOS input held near its threshold draws extra supply current and can make the output oscillate; tie unused inputs high or low, or use a pull-up or pull-down resistor.

On the exam

Exam point: a TTL input reads 0 to 0.8 V as low and 2 V or more as high, and anything between is undefined; a 5 V CMOS input needs about 70% of the supply for a high and 30% or less for a low. In positive logic the higher voltage is the 1.

Digital clocks

Competency 13.10 asks you to describe digital clock usage and circuitry. NEETS: a clock is a timing signal the equipment generates to control its operations; flip-flops, counters and registers act only when the clock is in the right condition, usually on one of its edges. A clock is a square wave or pulse train described by its period T, its frequency f, and its duty cycle (the fraction of each period it is high). The rising edge is the low-to-high transition and the falling edge the high-to-low one.

f = 1 / T  ·  T = 1 / f
f = 1.44 / ((R_a + 2R_b) × C)  ·  tH = 0.693 × (R_a + R_b) × C  ·  tL = 0.693 × R_b × C

Worked example

Clock period and a 555 clock: a 4 MHz clock has a period of 1 / 4000000 = 250 ns. For a 555 with RA = 1 kΩ, RB = 10 kΩ and C = 0.01 µF, TI's formula gives f = 1.44 / ((1000 + 20000) × 0.00000001) = 1.44 / 0.00021 ≈ 6857 Hz. The high time is 0.693 × 11000 × 0.00000001 ≈ 76.2 µs and the low time 0.693 × 10000 × 0.00000001 ≈ 69.3 µs, a duty cycle of 11000 / 21000 ≈ 52.4%. The 1.44 is 1 / 0.693 rounded; the exact constant, 1 / ln 2 ≈ 1.4427, gives about 6870 Hz.

The 555 Timer calculator works these formulas, and the Scope Lab shows how to read period and duty cycle off a screen.

Flip-flops

Competency 13.4 asks you to explain the purpose of flip-flops and list common types. NEETS: flip-flops are bistable multivibrators, used to store data temporarily, to multiply or divide, to count, and to receive and transfer information. Each has two complementary outputs, Q and Q' (not-Q): when Q is 1, Q' is 0. A flip-flop holds one bit for as long as it has power. NEETS names four types:

TypeInputsWhat it does
R-S (set-reset)S, RA high on S with R low sets Q to 1; the opposite resets it to 0 (NEETS). Both active at once is the invalid state (Kuphaldt).
D (data)D, clockOn the active clock edge Q takes the value on D, so the data reaches the output up to one clock pulse late (NEETS).
T (toggle)TChanges state each time its input is pulsed (NEETS).
J-KJ, K, clock, preset, clearLike R-S without the invalid state: with J and K both high it toggles on every clock edge (NEETS, Kuphaldt).

The J-K's action on each active clock edge (Q is the output before the edge):

J KAfter the clock edge
0 0No change: Q holds
0 1Reset: Q = 0
1 0Set: Q = 1
1 1Toggle: Q changes to Q'

Kuphaldt: the preset and clear inputs are asynchronous, forcing Q to 1 or 0 at once regardless of the clock; a bubble on them means they are active low. On a symbol, a small triangle at the clock input marks an edge-triggered device, and a bubble before it means it acts on the falling edge (NEETS shows the same for the T input).

Worked example

A toggling flip-flop divides by two: a J-K flip-flop with J and K tied high, clocked at 1 kHz, toggles on every falling edge. Its Q output goes high on one edge and low on the next, so it completes one cycle for every two clock cycles: a 1000 / 2 = 500 Hz square wave. Chaining flip-flops so that each clocks the next is how the counters in section 6 work.

Trap

Exam trap: a latch and a flip-flop are not the same. Kuphaldt: a latch follows its inputs for as long as its enable input is active, while a flip-flop responds only at the moment of a clock edge. A D latch's output can change several times while it is enabled; a D flip-flop's changes at most once per clock edge.

On the exam

Exam point: a flip-flop stores one bit, and a clocked flip-flop's data inputs act only on its clock edge (preset and clear act at once); a J-K flip-flop with J and K both high toggles on every clock pulse, so its output is half the clock frequency. The four types to know are R-S, D, T and J-K.

Counters and registers

Competency 13.3 asks you to explain how electronic counters operate. NEETS: a counter is a series of flip-flops wired to count, used to count operations, quantities or periods of time, to divide frequencies and to address information in storage. The number of different states a counter can show is its modulus: with n flip-flops, 2n. Each toggling stage halves the frequency it receives, so the last stage's output is the clock divided by the modulus.

N = 2^n  ·  fout = f_in / 2^n

Worked example

A four-stage counter on a 1 MHz clock: the modulus is 24 = 16, so it shows 0000 to 1111, 0 to 15, and the 16th pulse returns it to 0000. Each stage halves the frequency: 500 kHz, 250 kHz, 125 kHz and finally 1000000 / 16 = 62500 Hz, 62.5 kHz. Adding a fifth stage doubles the modulus to 25 = 32.

Trap

Exam trap: the modulus is not the highest count. A four-stage counter has a modulus of 16 but its highest count is 15, because 0000 is one of the 16 states. To count to 16 you need a fifth stage (NEETS).

On the exam

Exam point: a binary counter with n flip-flops has a modulus of 2 to the power n, so four stages count 0 to 15 and divide the clock by 16; a ripple counter clocks each stage from the one before it, a synchronous counter clocks them all at once.

Registers. NEETS: a register is a temporary storage device for data, addresses and operation codes, named by its number of bits (an eight-stage register is an 8-bit register), and its contents are called a word. A shift register moves its contents one stage per clock pulse; Kuphaldt: an n-stage shift register delays data by n clock times, and the serial-in, parallel-out type (his example is the 74AHC595) takes bits in one at a time and presents them all at once on its outputs. The Digital / Logic tool's Counter / Flip-Flop Frequency Divider computes any stage's output.

The bus

Competency 13.5 asks you to explain the purpose of a digital bus and show how it connects to the sections of a product. A bus is a set of parallel lines shared by every section it connects: the processor, memory and input/output circuits all attach to the same lines, and only the selected section uses them at any moment. Kuphaldt's processor diagram shows the three groups: the address bus selects the location, the data bus carries the data to or from it, and the control bus carries the signals that coordinate who uses the bus and when (read, write, clock and the like). Section 2 of the Computer Electronics guide describes each group.

Only one device may drive a bus line at a time. Kuphaldt's memory example shows how: each memory cell connects to the data bus through tristate buffers, and a decoder enables only the cell whose address is on the address lines, leaving every other cell in its high-impedance state, disconnected. When nothing drives a line it floats; TI warns that a floating CMOS bus raises power consumption and risks damage, and recommends a pull-up or pull-down resistor, usually 1 to 10 kΩ, to hold the line at a defined level.

Worked example

How far an address bus reaches: n address lines select 2n locations. A 16-line address bus reaches 216 = 65536 locations (64K), and a 20-line bus 220 = 1048576 (1M). The data bus width is separate: an 8-bit data bus moves one byte, one of 28 = 256 values, per transfer.

Displays

Competency 13.6 asks you to list types of display circuitry and describe how numbers and letters are activated digitally. A digital circuit lights a display by driving each of its elements on or off, and a decoder turns a binary code into the pattern of elements that forms a character.

Worked example

Displaying a 3: the BCD input is 0011. A 3 needs segments a, b, c, d and g, five of the seven, with e and f dark. Driving a common-anode display, the SN74LS47 pulls those five outputs low and leaves e and f off; an SN74LS48 driving a common-cathode display takes the same five outputs high. A 1 needs only b and c, and an 8 all seven.

Trap

Exam trap: on a common-anode display a segment is lit by a low, not a high. Its anodes all sit at the positive supply, so the driver must sink current from a segment's cathode, which is why the SN74LS47's outputs are active low. Pairing an active-high driver with a common-anode display gives the wrong segments.

On the exam

Exam point: a seven-segment display forms a digit by lighting segments a to g; a common-anode display lights a segment when its driver output goes low, and a common-cathode display when it goes high. The SN74LS47 is the classic active-low, common-anode driver.

Converters and memory

ETA's competency 13 list does not name these two families of digital devices, and memory is competency 15.4, but every digital product has them. Section 1 of the Interfacing guide and section 4 of the Computer Electronics guide cover them in more depth.

Worked example

ADC resolution: an n-bit ADC has 2n output codes and so 2n − 1 steps from bottom to top. Kuphaldt's example: a 10-bit ADC measuring a 40 ft tank divides it into 1023 steps of 40 / 1023 ≈ 0.039101 ft (0.46921 in). An 8-bit ADC over 0 to 5 V has 256 codes and 255 steps, about 5 / 255 ≈ 19.6 mV each.

Microcontrollers and simple commands

Competency 13.12 asks you to define microcontrollers and simple programming commands. Kuphaldt: memory, an arithmetic logic unit and a control unit together make a processor; with only minimal memory (its registers) and everything on a single chip, it is a microprocessor, which needs external memory and input/output chips. A microcontroller adds the program memory, data memory and input/output pins on the same chip, so it is a complete small computer. Microchip's PIC16F84A shows the scale: an 8-bit microcontroller with 1024 words of flash program memory, 68 bytes of data RAM, 64 bytes of data EEPROM, 13 I/O pins whose direction is set individually, and 35 instructions. The difference from a microprocessor is in section 6 of the Computer Electronics guide.

A microcontroller program sets its pins as inputs or outputs, then reads and writes them in a loop. The Arduino language reference describes the commands used on its boards:

CommandWhat it does (Arduino reference)
setup()Runs once after each power-up or reset: set pin modes and starting values here.
loop()Runs over and over after setup(), so the program keeps responding.
pinMode(pin, OUTPUT)Makes a pin an output; INPUT makes it an input, and INPUT_PULLUP an input with its internal pull-up resistor on.
digitalWrite(pin, HIGH)Sets an output pin to 5 V (3.3 V on 3.3 V boards); LOW sets it to 0 V.
digitalRead(pin)Returns HIGH or LOW. A pin connected to nothing can return either, at random.
delay(ms)Pauses the program for that many milliseconds (1000 ms = 1 s).

Worked example

Blinking an LED: setup() runs pinMode(13, OUTPUT); loop() runs digitalWrite(13, HIGH), delay(500), digitalWrite(13, LOW), delay(500). Each pass through loop() takes 500 + 500 = 1000 ms, so pin 13 makes a 1 Hz square wave, high for 500 of every 1000 ms: a 50% duty cycle. A logic probe on pin 13 would blink once a second.

Programming concepts and languages are competencies 15.6 and 15.7. The Computer Electronics guide's section 9 covers the programming concepts (variables; sequence, selection and iteration; and the edit, compile, load and debug cycle), and section 10 the languages: machine code, assembly, compiled and interpreted languages, and ladder logic for PLCs.

Logic probes and pulsers

Competency 13.8 asks you to describe how logic probes are used to verify states in digital equipment, and competency 13.7 to distinguish how pulsers are used for digital signal tracing. The probe reads; the pulser drives. Section 8 of the Test Equipment guide covers both tools in full, with their precautions.

Worked example

Checking a NAND gate in circuit: HP verifies gates by pulsing an input and looking for the pulse at the output. Pulse input A of a 2-input NAND gate with the probe on its output. If input B is high, the output follows (AB)' and should pulse; if B is low, the output stays high whatever A does (truth table, section 2), so a steady output proves nothing until B is high. With B high and still no pulse at the output, suspect the gate or its output node.

On the exam

Exam point: a logic probe shows a node's state and a logic pulser injects a brief pulse of the opposite state into it; with both on the same node, a steady low while pulsing means the node is shorted to ground. A steady high in the same test means a short to the supply.

Troubleshooting digital signals

Competency 13.9 asks you to explain how to troubleshoot digital signals. HP's 1972 article on the logic probe and pulser describes the method: first use the probe to look for missing key signals, such as the clock, start, shift, reset or enable lines, which narrows the fault to a small group of ICs; then supply stimulus with the pulser and check each package against its truth table.

  1. Confirm power and ground at the IC. Measure from the chip's own supply pin to its ground pin; 74-series TTL needs 4.75 to 5.25 V (TI).
  2. Check the clock and control lines. A probe that blinks on the clock pin shows pulses are arriving; check reset and enable are at their working levels (HP).
  3. Compare each node with what the logic says. Use the truth table, or the counting sequence for a counter, to predict every output from its inputs, then probe for the node that disagrees.
  4. Classify the bad node. Steady high, steady low, a bad level (between the thresholds) or open. An open TTL input floats to about 1.4 V and the probe shows a bad level (HP); a tristate output in its high-impedance state also reads as open.
  5. Find the cause with probe and pulser together. A node that stays low while pulsed is shorted to ground, and one that stays high is shorted to the supply (HP). On a long chain, pulse one end and check halfway along, then keep halving (HP).
  6. Check timing with a scope. A probe shows states, not edges. TI warns that slow input edges or inputs held near the threshold can make CMOS outputs oscillate, which the oscilloscope reveals.

Worked example

A display that will not count: HP's counter check. Reset the counter, pulse the clock input of one counting stage a known number of times, then pulse the display latch's clock: the digit should show the number of pulses. If it does, the fault is elsewhere; if not, the probe and pulser narrow it to the counting stage, the latch, the decoder or the display itself.

Trap

Exam trap: an open TTL input is not a low. Kuphaldt: a floating TTL input is read as a high, so the gate acts as if it had a 1 there, while HP's probe shows the input at about 1.4 V as a bad level. HP adds that broken bonds inside ICs are a large share of IC failures, and a broken output bond leaves the input it drives open in exactly this way.

Signal tracing in general, the half-split method and documenting the repair are in the Work Procedures guide.

On the job: a stuck line on a logic board

Job practice, not exam content. A typical sequence for a dead control line on a digital board. The equipment manual and your employer's procedures come first.

  1. Set the probe up for the board. Clip it to the board's own supply and ground and set the TTL or CMOS switch to match the logic family; on the wrong setting it can call a good level bad (section 8 of the Test Equipment guide).
  2. Start from the symptom and work back. Probe the stuck output, then the inputs of the gate that drives it. If the inputs are right for the output you expect and the output is wrong, the gate or its output node is the suspect.
  3. Put the pulser and probe on the stuck node. If the node still will not move, it is shorted: a steady low is a short to ground, a steady high a short to the supply (HP). The short can be at any input or output tied to that node, not only at the IC driving it.
  4. Halve a long path. On a chain of gates or a long trace, pulse at one end and probe the middle, then the middle of the bad half (HP).
  5. Replace like with like. An LS part and an HC part do not accept the same input levels (section 3), so match the family letters as well as the number, and handle CMOS replacements with ESD precautions.

Check yourself

Answer in your head first, then reveal.

  1. How many rows does a truth table need, and when is a NAND output low?

    a truth table lists every combination of the inputs, so two inputs need 4 rows and three need 8; a NAND output is low only on the row where every input is high

  2. What voltages does a TTL input read as low and high, and what does a 5 V CMOS input need?

    a TTL input reads 0 to 0.8 V as low and 2 V or more as high, and anything between is undefined; a 5 V CMOS input needs about 70% of the supply for a high and 30% or less for a low

  3. When does a flip-flop change state, and what does a J-K flip-flop do with J and K both high?

    a flip-flop stores one bit, and a clocked flip-flop's data inputs act only on its clock edge (preset and clear act at once); a J-K flip-flop with J and K both high toggles on every clock pulse, so its output is half the clock frequency

  4. What is the modulus of an n-stage binary counter, and how do ripple and synchronous counters differ?

    a binary counter with n flip-flops has a modulus of 2 to the power n, so four stages count 0 to 15 and divide the clock by 16; a ripple counter clocks each stage from the one before it, a synchronous counter clocks them all at once

  5. How does a seven-segment display form a digit, and how is each display type driven?

    a seven-segment display forms a digit by lighting segments a to g; a common-anode display lights a segment when its driver output goes low, and a common-cathode display when it goes high

  6. What do a logic probe and a logic pulser each do, and what does a steady low while pulsing mean?

    a logic probe shows a node's state and a logic pulser injects a brief pulse of the opposite state into it; with both on the same node, a steady low while pulsing means the node is shorted to ground

Practice this topic: Digital questions are in the Study Hub quiz bank, and the key terms are in Flashcards.