UNIT 01 · LESSON 2 OF 6

Digital Signals and Logic Levels

Where is the line, who draws it, and what happens to a voltage that lands near it?

INTERACTIVEFrom a voltage to a logic state
Analog input voltage with the logic state read by a plain input and by a Schmitt-trigger input02468100123Pin voltage (V)VIH = 2 VVIL = 0.8 VVT+ = 1.8 VVT− = 1.2 Vundefined bandPlain input: LOW / undefined / HIGH10Schmitt-trigger input reads · changed 4 times10Time (ms)0246810
Analog input voltage with the logic state read by a plain input and by a Schmitt-trigger input02468100123Pin voltage (V)VIH = 2 VVIL = 0.8 VVT+ = 1.8 VVT− = 1.2 Vundefined bandPlain input: LOW / undefined / HIGH10Schmitt-trigger input reads · changed 4 times10Time (ms)0246810

Try this

Plain threshold input: guarantee-region changes 45 times (not a measured edge count); undefined for 34% of the window. Schmitt-trigger input: changed 4 times. Example thresholds: VIL ≤ 0.8 V, VIH ≥ 2 V, VT+ = 1.8 V, VT− = 1.2 V.

The top trace is the real voltage on the input pin. Below it are two readings of the same trace. A plain threshold input has an undefined band between VIL and VIH: inside it the datasheet promises nothing, so the diagram shows a hatched gap, not a guess. A Schmitt-trigger input switches high only above VT+ and low only below VT−, so noise that stays inside the hysteresis window cannot flip it. Thresholds shown are an illustrative 3.3 V example.

What you will be able to do
  • Read VIL, VIH, VOL and VOH from a datasheet and say which side of the interface each one describes.
  • Explain why the region between VIL and VIH is undefined and not simply 'the switching point'.
  • Compute high and low noise margins for a driver–receiver pair and decide whether they are compatible.
  • Describe how a Schmitt-trigger input uses two thresholds to reject noise on slow edges.
  • Explain why 'both parts are 3.3 V' does not by itself prove two parts can talk to each other.
Before you start
  • Voltage as a difference from ground, and current as a flow (lesson 1).
  • Reading a simple x–y plot.
Steps in this lesson
  1. Two states, one continuous quantity
  2. Outputs promise, inputs require
  3. Noise margins
  4. Worked example: two real 3.3 V-compatible thresholds
  5. The Schmitt trigger: two thresholds instead of one
  6. Why “3.3 V logic” proves nothing by itself
  7. Common misconceptions

The puzzle

A pin can only ever carry a voltage, and voltages are continuous: 0.02 V, 1.37 V, 3.29 V. Yet firmware reads the pin and gets exactly one of two answers, 0 or 1. Somewhere between the wire and the register, a decision is made. Where is the line, who draws it, and what happens to a voltage that lands near it?

STEP 1

Two states, one continuous quantity

A digital input is a comparator with an opinion. The chip’s designers promise that any voltage at or below some level, called VIL (input low), will be read as 0, and any voltage at or above a higher level, VIH (input high), will be read as 1. Those two numbers are printed in the datasheet, and they are the only promises made about the input.

Between them lies a gap. The datasheet does not say what a voltage in the gap will read. Not “probably 1”, not “it switches at 1.4 V”: nothing. A real input does switch somewhere in that band, but where moves with temperature, supply voltage and manufacturing spread, and the device may even read the same voltage differently from one moment to the next. Treat the gap as undefined.

↑ This step uses the figure at the top of the page.

The figure feeds a real, noisy voltage into two kinds of input. Watch the top row: every time the trace wanders into the hatched band, the plain-threshold reading goes blank rather than showing a guess. Increase the noise and observe the changes between guaranteed LOW, undefined and guaranteed HIGH. Those changes are not a prediction of the actual edge count inside the undefined band.

STEP 2

Outputs promise, inputs require

There are four numbers, and they belong to two different parties.

SymbolWhoMeaning
VOLV_{OL}driver (output)highest voltage the output will produce when it drives a 0, at a stated load current
VOHV_{OH}driver (output)lowest voltage the output will produce when it drives a 1, at a stated load current
VILV_{IL}receiver (input)highest voltage the input is guaranteed to read as 0
VIHV_{IH}receiver (input)lowest voltage the input is guaranteed to read as 1

An output does not care what the receiving chip needs; it simply guarantees to stay below VOLV_{OL} and above VOHV_{OH} as long as you do not load it beyond the stated current. An input does not care who is driving it; it guarantees to read correctly outside the undefined band. Compatibility is the question of whether one chip’s promises satisfy the other chip’s requirements.

STEP 3

Noise margins

Wires pick up noise, ground bounces a little when other outputs switch, and a long cable has a voltage drop. The difference between what the driver guarantees and what the receiver needs is the room you have for all of that:

NMH=VOH(min⁡)−VIH(min⁡)NM_H = V_{OH(\min)} - V_{IH(\min)} NML=VIL(max⁡)−VOL(max⁡)NM_L = V_{IL(\max)} - V_{OL(\max)}

Both must be positive, and larger is safer. Application notes from logic vendors define them exactly this way (AN-363 in words, SZZA036C as a picture).

INTERACTIVEDoes this output satisfy that input?
Driver output guarantees compared with receiver input thresholds0 V1 V2 V3 V4 V5 VLOW outHIGH outDriver guaranteessupply 3.3 VVOH ≥ 2.4VOL ≤ 0.4reads LOWundefinedreads HIGHReceiver needssupply 5 VVIH ≥ 3.5VIL ≤ 1.5pin max 5.5 Vhigh margin -1.1 Vlow margin 1.1 VNot compatible: a margin is zero or negative (see below).
Driver output guarantees compared with receiver input thresholds0 V1 V2 V3 V4 V5 VLOW outHIGH outDriver guaranteessupply 3.3 VVOH ≥ 2.4VOL ≤ 0.4reads LOWundefinedreads HIGHReceiver needssupply 5 VVIH ≥ 3.5VIL ≤ 1.5pin max 5.5 Vhigh margin -1.1 Vlow margin 1.1 VNot compatible: a margin is zero or negative (see below).
High noise margin = VOH − VIH = 2.4 − 3.5 = -1.1 V. Low noise margin = VIL − VOL = 1.5 − 0.4 = 1.1 V. A driver high of 2.4 V does not reach the receiver’s 3.5 V minimum: a HIGH may be read as undefined.

Left: what the driver guarantees to produce. Right: what the receiver needs to see. The high noise margin is VOH(min) − VIH(min); the low noise margin is VIL(max) − VOL(max). Both must be positive, and the driver’s high level must also stay below the receiver’s pin rating. Values are rounded examples of common families; always read the two real datasheets.

Try the 3.3 V LVTTL-style driver into the 5 V CMOS input. The high margin is negative: a guaranteed-high of 2.4 V does not reach the 3.5 V the 5 V CMOS input insists on. It might work on the bench, because the driver typically outputs closer to 3.3 V and the input typically switches near 2.5 V, but nothing guarantees it, and the first hot day or slightly weak unit will find the gap.

STEP 4

Worked example: two real 3.3 V-compatible thresholds

The JEDEC 3.3 V interface standard (JESD8C) sets the levels most “3.3 V logic” follows: inputs must accept VIH≥2.0V_{IH} \ge 2.0 V and VIL≤0.8V_{IL} \le 0.8 V; LVTTL-compatible outputs must produce VOH≥2.4V_{OH} \ge 2.4 V while sourcing 2 mA and VOL≤0.4V_{OL} \le 0.4 V while sinking 2 mA. The RP2040 datasheet lists the same 2.0 V / 0.8 V input thresholds at IOVDD = 3.3 V, with VOL≤0.5V_{OL} \le 0.5 V and VOH≥2.62V_{OH} \ge 2.62 V at whatever drive-strength current is selected.

Suppose a JESD8C LVTTL-style output drives an RP2040 input:

NMH=2.4−2.0=0.4 VNM_H = 2.4 - 2.0 = 0.4\ \text{V} NML=0.8−0.4=0.4 VNM_L = 0.8 - 0.4 = 0.4\ \text{V}

Both margins are positive, so the pair is compatible on paper with 0.4 V of headroom each way. Now suppose the driver is the RP2040 and the receiver is a 5 V-supplied ATmega328P, whose datasheet requires VIH≥0.6 VCC=3.0V_{IH} \ge 0.6\,V_{CC} = 3.0 V at 5 V:

NMH=2.62−3.0=−0.38 VNM_H = 2.62 - 3.0 = -0.38\ \text{V}

Negative. The RP2040 cannot guarantee a 1 that the ATmega328P will guarantee to read as 1. The low side is fine (0.3×5−0.5=1.00.3 \times 5 - 0.5 = 1.0 V), which is typical: mixing supply voltages usually breaks the high margin first. A level shifter, or running the ATmega328P at 3.3 V, fixes it.

STEP 5

The Schmitt trigger: two thresholds instead of one

A slow or noisy edge lingers in the undefined band, and a plain input may flicker. A Schmitt-trigger input replaces the single band with two switching points: the input goes high only when the voltage rises above an upper threshold VT+V_{T+}, and goes low only when it falls below a lower threshold VT−V_{T-}. In between it holds its previous state. The difference VT+−VT−V_{T+} - V_{T-} is the hysteresis.

DIAGRAMTransfer curves: one threshold versus two
Output versus input voltage for a plain input and a Schmitt-trigger input0123lowhighPlain threshold inputInput voltage (V)not specifiedVILVIH0123lowhighSchmitt-trigger inputInput voltage (V)risingfallingVT−VT+hysteresis
Output versus input voltage for a plain input and a Schmitt-trigger input0123lowhighPlain threshold inputInput voltage (V)not specifiedVILVIH0123lowhighSchmitt-trigger inputInput voltage (V)risingfallingVT−VT+hysteresis
Plain input: one band, unspecified inside it. Schmitt input: two thresholds, switching depends on direction.

Output state against input voltage. Left: a plain input has a band where the output is not specified. Right: a Schmitt-trigger input stays LOW until the upper threshold on a rising input, and stays HIGH until the lower threshold on a falling input, so the switching point depends on direction. The loop width is the hysteresis.

Look again at the interactive figure at the top and compare the bottom two rows. With peak-to-peak noise smaller than the hysteresis on a monotonic edge, the Schmitt-trigger reading changes exactly once per intended edge, however slowly the edge crawls. Most microcontroller inputs offer Schmitt triggers, sometimes always on, sometimes as an option; the RP2040 specifies at least 0.2 V of hysteresis at 3.3 V when its Schmitt trigger is enabled. Whether the hysteresis is bigger than your noise is a question you still have to answer.

Hysteresis is not free: it adds a little delay and it does not help if the noise is larger than the window. But for buttons, slow sensors and long cables it is the difference between one edge and a burst of them.

STEP 6

Why “3.3 V logic” proves nothing by itself

Two parts can both run from 3.3 V and still fail to communicate:

  • One might use CMOS-style thresholds (fractions of the supply, say VIH≥0.7 VDDV_{IH} \ge 0.7\,V_{DD} = 2.31 V) while the other only guarantees an LVTTL-style VOH≥2.4V_{OH} \ge 2.4 V at its rated load. The margin is 0.09 V, and a 150 mV ground offset eats it.
  • The receiver’s absolute maximum pin voltage may be VDD+0.3V_{DD} + 0.3 V; a “3.3 V” driver running from a poorly regulated 3.6 V rail can exceed it.
  • Open-drain outputs (common on I²C and on many interrupt lines) produce a high level only through a pull-up resistor, so their VOHV_{OH} depends on your resistor and the bus load, not on the datasheet.

The supply label tells you where to start looking. The four threshold numbers, at your actual currents and temperature, tell you whether it works.

MYTHS AND FACTS

Common misconceptions

The input switches halfway, at VDD/2

It switches somewhere between VIL and VIH, and the datasheet does not promise where.

A reading in the undefined band is random noise

It can be stable for a long time and then change with temperature. Stable is not the same as guaranteed.

VOH is the output voltage

It is the minimum high the output guarantees at a stated current. Draw more current and the guarantee is void; draw less and you usually get closer to the rail.

Schmitt triggers remove noise

For a monotonic edge, a noise excursion whose peak-to-peak span is less than the hysteresis cannot by itself cross both thresholds. Larger noise still passes through.

Same supply voltage means compatible

Compare the four numbers; the supply label is a hint, not a proof.

Check yourself

Answer in your head, then open the card.

A driver guarantees VOL ≤ 0.4 V and VOH ≥ 2.4 V. A receiver needs VIL ≤ 0.8 V and VIH ≥ 2.0 V. What are the noise margins?

NML=0.8−0.4=0.4NM_L = 0.8 - 0.4 = 0.4 V and NMH=2.4−2.0=0.4NM_H = 2.4 - 2.0 = 0.4 V. Compatible, with 0.4 V of room for noise on each side.

The same driver feeds an input that needs VIH ≥ 3.5 V. Will it work?

Not reliably. NMH=2.4−3.5=−1.1NM_H = 2.4 - 3.5 = -1.1 V. The driver’s guaranteed high can be far below what the input requires, even if a particular pair of parts happens to work on the bench.

A sensor produces a 1 V-per-second ramp into a plain digital input. Why might the firmware see several edges instead of one?

The ramp spends 1.2 s crossing the 0.8–2.0 V undefined band (for the example thresholds). Any noise during that time can push the reading back and forth. A Schmitt-trigger input with hysteresis larger than the noise would switch once.

Why is an input threshold listed as “0.6 VCC” rather than as a fixed voltage?

Because the input’s switching circuit scales with the supply. At 5 V it needs 3.0 V; at 3.3 V it needs 1.98 V. Quoting a fraction covers every supported supply; you convert it for yours.

Sources (5)
  1. JEDEC JESD8C, Interface Standard for Nominal 3 V/3.3 V Supply Digital Integrated Circuits (June 2006; JESD8C.01 is the minor revision of September 2007) — Table 2 (inputs: VIH ≥ 2.0 V, VIL ≤ 0.8 V), Table 3 (LVTTL outputs: VOH ≥ 2.4 V at −2 mA, VOL ≤ 0.4 V at 2 mA), Table 4 (LVCMOS outputs at 100 µA), clause 4.3 noise margins; the PDF requires a free JEDEC account
  2. Raspberry Pi Ltd, RP2040 Datasheet (build 2025-02-20), §5.5.3.4 Table 625 “Digital IO characteristics”, pp. 615–616 — at IOVDD = 3.3 V: VIL ≤ 0.8 V, VIH ≥ 2.0 V, hysteresis ≥ 0.2 V with the Schmitt trigger enabled, VOL ≤ 0.5 V and VOH ≥ 2.62 V at the selected drive-strength current
  3. Microchip, ATmega48A/PA/88A/PA/168A/PA/328/P Data Sheet, DS40002061B (Rev. B, 08/2020), Table 30-1 “Common DC characteristics”, pp. 322–323 — VIL ≤ 0.3 VCC and VIH ≥ 0.6 VCC for VCC = 2.4–5.5 V; notes 1 and 2 define Max/Min as the values where the pin is ensured to read low/high
  4. Texas Instruments, SZZA036C “Understanding and Interpreting Standard-Logic Data Sheets” (Dec 2002, rev. June 2016), Figure 50 — graphical definition of the high and low noise margins between VOH/VIH and VIL/VOL
  5. onsemi (Fairchild), AN-363 “Designing with TTL” (June 1984) — text definition: the logic-0 noise margin is VIL − VOL and the logic-1 noise margin is VOH − VIH