📘 CodingMarble Learn

Digital Signal Processing: Combinational Logic, Sequential Logic and Astables

Digital signals have only two levels: 1 (high) and 0 (low). Combinational logic (gates such as AND, OR, NOT, NAND, NOR, XOR) gives an output that depends only on the inputs now. Sequential logic (flip-flops, counters) also depends on what happened before, so it has memory; it changes on clock pulses. An astable circuit has no stable state and switches by itself, making the clock square wave. Its frequency f = 1/T.

🎬 Step-by-step story

  1. Combinational logic: an AND gate. A = 1, B = 0, so the output lamp Y is off. The output depends only on the inputs right now.
  2. Each gate has a truth table. Here an XOR gate: A = 1, B = 1 gives Y = 0. Tap the buttons to try every gate and every input pair.
  3. Sequential logic: a D flip-flop. On the rising edge of the clock (red wave) it copies the input D to Q, then keeps it. That is 1 bit of memory.
  4. Join three flip-flops and you get a binary counter. Each clock pulse adds 1: 000, 001, 010 … 111, then back to 000.
  5. An astable has no stable state. It flips high, low, high by itself and makes the clock square wave. Period T = time high + time low; f = 1/T.
  6. Free play: build truth tables with A, B and Next gate, then press Clock pulse and count in binary.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Why does the AND lamp stay off when only A is on?

AND needs every input to be 1. B is 0, so Y is 0.

What is the difference between OR and XOR?

Both give 1 when exactly one input is 1. For 1 and 1, OR gives 1 but XOR gives 0. Try it with the gate button.

If D changes between clock pulses, does Q change?

No. Q only copies D at the rising clock edge. In between it holds its value.

Why does each flip-flop in the counter flash at half the speed of the one before?

Each stage toggles once for every two toggles of the stage before, so frequency halves at every stage.

Where does the clock signal come from?

From an astable: a circuit with no stable state that keeps switching high and low by itself.

Digital signals

A digital signal has two levels only: 1 (high), e.g. 5 V, and 0 (low), e.g. 0 V. Noise that changes 5 V to 4.6 V does not change the meaning, so digital signals can be copied and processed without errors piling up.

Combinational logic

In combinational logic the output depends only on the inputs at that moment. Basic gates:

A truth table lists the output for every input combination. With n inputs there are 2ⁿ rows. Gates can be combined; NAND alone (or NOR alone) can build any other gate. Combinational systems include decoders, adders and the logic in a burglar alarm.

Boolean expressions

We write AND as A·B, OR as A + B and NOT as Ā. Example: Y = (A·B) + C̄.

Sequential logic

In sequential logic the output depends on the inputs and on the previous state. It needs memory. The basic memory cell is the flip-flop (a bistable: it has two stable states).

D-type flip-flop

Inputs D (data) and clock; output Q. On the rising edge of the clock, Q becomes equal to D. Between edges Q does not change, whatever D does. So it stores one bit.

Counters and dividers

If a D flip-flop's Q̄ output is fed back to D, Q toggles on every clock pulse: the output frequency is half the clock frequency (a divide-by-2). Chaining 3 such stages gives a 3-bit binary counter (0 to 7); n stages count to 2ⁿ − 1. Decade counters count 0–9 and reset, used in clocks and displays.

Shift registers

Flip-flops in a line, each passing its bit to the next on each clock, move data along: used to turn serial data into parallel data.

Astables

A bistable has two stable states; a monostable has one; an astable has none: it keeps switching between high and low by itself, giving a square or rectangular wave. This is the clock for sequential logic.

Period: T = t_high + t_low, frequency f = 1/T. The mark-space ratio is t_high : t_low.

A common astable is built with a 555 timer IC, a capacitor and two resistors. The capacitor charges and discharges, and the times depend on R × C: bigger R or C → slower clock. For a 555 astable, t_high ≈ 0.7(R₁ + R₂)C and t_low ≈ 0.7R₂C.

Try it: a paper flip-flop

Write 0 on one side of a coin-sized paper and 1 on the other. Only flip it when someone claps (the clock). Between claps, ignore all shouting (D changes). You are a flip-flop! Now in the 3D, press Clock pulse 5 times and check the lamps show 101.

Key formulas and definitions

Worked examples

1. Write the truth table of a 2-input NAND gate.

00 → 1, 01 → 1, 10 → 1, 11 → 0. (AND, then NOT.)

2. How many rows does a truth table for 4 inputs have?

2⁴ = 16 rows.

3. Y = A·B + C. Find Y for A = 1, B = 0, C = 1.

A·B = 0; 0 + 1 = 1. Y = 1.

4. An astable is high for 3 ms and low for 1 ms. Find f and the mark-space ratio.

T = 4 ms; f = 1/0.004 = 250 Hz. Mark-space = 3:1.

5. A 1 kHz clock drives a chain of 4 divide-by-2 flip-flops. What is the output frequency of the last stage?

1000 / 2⁴ = 62.5 Hz.

6. A 3-bit counter starts at 000. What does it show after 11 clock pulses?

Counts wrap after 8: 11 − 8 = 3, so 011.

7. A 555 astable has R₁ = 10 kΩ, R₂ = 20 kΩ, C = 10 μF. Find t_high, t_low and f.

t_high = 0.7 × 30 000 × 10⁻⁵ = 0.21 s; t_low = 0.7 × 20 000 × 10⁻⁵ = 0.14 s; T = 0.35 s; f ≈ 2.9 Hz.

Common mistakes

Practice quiz

1. Which gate gives 1 only when its inputs are different?
2. Sequential logic differs from combinational logic because it has:
3. A D flip-flop changes Q:
4. An astable has how many stable states?
5. A square wave has period 5 ms. Its frequency is:

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

What is the difference between combinational and sequential logic?

Combinational output depends only on current inputs (gates, adders). Sequential output also depends on past inputs because it stores state in flip-flops (counters, registers).

What does an astable do?

It switches between high and low on its own with no stable state, giving a square wave used as a clock. Its frequency is f = 1/(t_high + t_low).

How does a flip-flop divide frequency by 2?

With Q̄ fed back to D, Q toggles once per clock pulse, so it needs two clock pulses for one full cycle of its own: half the frequency.

Where this is taught

England (GCSE, A level)Year 133.13 Electronics

Learn first

Related lessons

All Physics lessons