This chapter explores clock signals—the heartbeat of digital systems. Clock signals provide timing and synchronization for digital circuits, processors, and communication systems. Understanding clock characteristics is essential for working with digital electronics and computer systems.
Definition: A periodic digital signal that oscillates between HIGH and LOW states at a regular frequency, used to coordinate operations in digital circuits.
┌──┐ ┌──┐ ┌──┐ ┌──┐
─────┘ └──┘ └──┘ └──┘ └──── Clock Signal
|←T→| (Period)
Purpose:
- Synchronize operations across components
- Coordinate data transfers
- Control timing of state changes
- Sequence operations in processors
Definition: Number of complete cycles per second
Unit: Hertz (Hz)
- 1 Hz = 1 cycle per second
- 1 kHz = 1,000 Hz
- 1 MHz = 1,000,000 Hz
- 1 GHz = 1,000,000,000 Hz
Formula:
f = 1 / T
where:
f = frequency (Hz)
T = period (seconds)
Examples:
1 MHz → 1,000,000 cycles/second
16 MHz → 16,000,000 cycles/second
3.5 GHz → 3,500,000,000 cycles/second
Definition: Time for one complete cycle
Unit: Seconds (s), milliseconds (ms), microseconds (μs), nanoseconds (ns)
Formula:
T = 1 / f
where:
T = period (seconds)
f = frequency (Hz)
Examples:
1 kHz → T = 1/1000 = 0.001 s = 1 ms
1 MHz → T = 1/1,000,000 = 1 μs
1 GHz → T = 1/1,000,000,000 = 1 ns
Definition: Percentage of time the signal is HIGH during one period
Formula:
Duty Cycle = (t_HIGH / T) × 100%
where:
t_HIGH = time signal is HIGH
T = total period
Common Values:
- 50% Duty Cycle: Signal HIGH and LOW for equal times (square wave)
- 25% Duty Cycle: Signal HIGH for 1/4 of period
- 75% Duty Cycle: Signal HIGH for 3/4 of period
Examples:
Period T = 1 ms:
50% duty cycle: HIGH for 0.5 ms, LOW for 0.5 ms
25% duty cycle: HIGH for 0.25 ms, LOW for 0.75 ms
75% duty cycle: HIGH for 0.75 ms, LOW for 0.25 ms
Rising Edge (Positive Edge):
- Transition from LOW to HIGH
- Often used to trigger flip-flops and latches
- Symbol: ↑ or ⤴
Falling Edge (Negative Edge):
- Transition from HIGH to LOW
- Also used for triggering in some circuits
- Symbol: ↓ or ⤵
Rising Edge ↑ Falling Edge ↓
┌── ──┐
│ │
─────────┘ └─────
Edge-Triggered Devices:
- Positive Edge-Triggered: Responds to LOW→HIGH transition
- Negative Edge-Triggered: Responds to HIGH→LOW transition
┌───┐ ┌───┐ ┌───┐ ┌───┐
HIGH │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
LOW───┘ └───┘ └───┘ └───┘ └───
|←─T─→|
t_HIGH = T/2
┌─┐ ┌─┐ ┌─┐ ┌─┐
HIGH │ │ │ │ │ │ │ │
│ │ │ │ │ │ │ │
LOW───┘ └─────┘ └─────┘ └─────┘ └─────
|←─T─→|
t_HIGH = T/4
┌───────┐ ┌───────┐ ┌───────┐
HIGH │ │ │ │ │ │
│ │ │ │ │ │
LOW───┘ └─┘ └─┘ └─
|←─T─→|
t_HIGH = 3T/4
32.768 kHz → Real-time clock (RTC) crystals
8 MHz → Arduino (internal oscillator)
16 MHz → Arduino Uno, Nano (crystal)
48 MHz → ARM Cortex-M0
80 MHz → ESP8266 WiFi module
240 MHz → ESP32 dual-core
4.77 MHz → Original IBM PC (1981)
1 GHz → Pentium III (1999)
3.5 GHz → Modern desktop CPU (typical)
5.0 GHz → High-performance CPU (boost)
9600 bps → UART (common baud rate)
100 kHz → I2C (standard mode)
400 kHz → I2C (fast mode)
1 MHz → SPI (typical)
48 MHz → USB Full Speed
133 MHz → DDR SDRAM (PC2100)
800 MHz → DDR2 SDRAM
1600 MHz → DDR3 SDRAM
3200 MHz → DDR4 SDRAM (effective)
Given: f = 50 MHz
Find: T = ?
T = 1 / f
T = 1 / 50,000,000
T = 0.00000002 seconds
T = 20 nanoseconds (ns)
Given: T = 125 μs
Find: f = ?
f = 1 / T
f = 1 / 0.000125
f = 8,000 Hz
f = 8 kHz
Given: T = 1 ms, t_HIGH = 0.75 ms
Find: Duty Cycle = ?
Duty Cycle = (t_HIGH / T) × 100%
Duty Cycle = (0.75 / 1) × 100%
Duty Cycle = 75%
Given: f = 3 GHz processor
Find: Instructions per cycle = 1 (simplified)
Instructions per second = f × IPC
Instructions per second = 3,000,000,000 × 1
Instructions per second = 3 billion per second
[Crystal Oscillator]
|
[PLL/Clock Multiplier]
|
[Clock Distribution Network]
/ | \ \
/ | \ \
[CPU] [RAM] [GPU] [Peripherals]
- Single Clock Domain: All components use same clock
- Multiple Clock Domains: Different frequencies for different subsystems
- Clock Domain Crossing: Special care needed when data crosses domains
Definition: Difference in arrival time of clock signal at different components
Causes:
- Wire length differences
- Loading differences
- Temperature variations
Impact: Can cause timing violations, data corruption
- Most accurate and stable
- Uses piezoelectric crystal (usually quartz)
- Common frequencies: 32.768 kHz (RTC), 8 MHz, 16 MHz, 25 MHz
- Simple, low cost
- Uses resistor-capacitor network
- Less accurate than crystal
- Common in microcontrollers (internal clock)
- Multiplies input frequency
- Generates higher frequencies from lower reference
- Example: 16 MHz crystal → 80 MHz CPU clock
- Reduces frequency
- Divides input clock by integer factor
- Example: 48 MHz → 12 MHz (divide by 4)
By the end of this chapter, you should be able to:
- Understand clock signal properties (frequency, period, duty cycle)
- Calculate frequency from period and vice versa
- Identify rising and falling edges
- Calculate duty cycle from timing measurements
- Recognize common clock frequencies in computer systems
- Understand clock synchronization in digital systems
- Explain the role of clock signals in processor operation
Run the interactive example:
python ch13_clock_signals.py- Frequency/Period Calculations: Converting between f and T
- Duty Cycle: Computing and visualizing different duty cycles
- Clock Visualization: ASCII art representation of clock signals
- Common Frequencies: Real-world clock speed examples
- Edge Detection: Rising and falling edge identification
- Timing Analysis: Practical timing calculations
- Performance Metrics: Operations per second calculations
============================================================
CHAPTER 13: Clock Signals
============================================================
--- Example 1: Clock Signal Definition ---
Frequency: 1000 Hz (1 kHz)
Period: 0.001 seconds (1.0 ms)
Clock visualization (50% duty cycle):
┌──┐ ┌──┐ ┌──┐ ┌──┐
─────┘ └──┘ └──┘ └──┘ └────
|←T→|
--- Example 2: Frequency ↔ Period Relationship ---
f = 1/T and T = 1/f
...
- CPU Clock: Coordinates instruction execution
- Bus Clock: Synchronizes data transfer
- Memory Clock: Times RAM access
- Cache Clock: Often higher than main CPU clock
- UART: Baud rate determines bit timing
- SPI: Clock line synchronizes data transfer
- I2C: Clock line controls communication
- Ethernet: Clock recovered from data stream
- Flip-Flops: Clocked storage elements
- Counters: Increment on each clock edge
- State Machines: Transition on clock edges
- Shift Registers: Move data on clock
- Timers: Generate interrupts at regular intervals
- PWM: Duty cycle control for motors, LEDs
- ADC: Sample analog signals at clock rate
- Real-Time Clock: Keep track of date/time
Q: Why is 32.768 kHz used for real-time clocks?
A: Because 32,768 = 2^15. Divide by 2 fifteen times to get 1 Hz (1 second), making it perfect for timekeeping with simple binary counters.
Q: Can a processor run without a clock?
A: Asynchronous circuits exist but are rare. Nearly all modern processors require a clock for synchronization.
Q: What's the difference between clock speed and processor speed?
A: Often the same, but processors can execute multiple instructions per clock cycle (IPC > 1), or boost/throttle frequency dynamically.
Q: Why do processors need such fast clocks (GHz)?
A: Higher frequency = more operations per second = faster computation. Each clock cycle can execute an instruction step.
Q: What is overclocking?
A: Running a component at higher frequency than rated. Increases performance but also heat, power consumption, and instability risk.
- Clock signals provide timing and synchronization
- Frequency (f) and period (T) are inversely related: f = 1/T
- Duty cycle: percentage of time signal is HIGH
- Rising and falling edges trigger state changes
- Modern CPUs run at GHz speeds (billions of cycles/second)
- 50% duty cycle is most common (square wave)
- Higher frequency = faster operation = more power/heat
- 🔌 Crystal oscillators provide accurate clock generation
- Calculate the period of a 16 MHz clock
- What is the frequency of a clock with a 50 ns period?
- A clock has period 2 ms and is HIGH for 1.5 ms. What is the duty cycle?
- How many clock cycles occur in 1 second for a 3 GHz processor?
- Convert 100 kHz to period in microseconds
- A signal is HIGH for 200 μs and LOW for 800 μs. Find frequency and duty cycle.
- Why is a 50% duty cycle clock preferred in most digital systems?
- If a processor executes 2 instructions per clock cycle at 2 GHz, how many instructions per second?
- Sketch a clock signal with 25% duty cycle for 3 complete periods
- Calculate: How long does one clock cycle take at 4.77 MHz (original IBM PC)?
- Learn about PLL (Phase-Locked Loop) circuits
- Study clock domain crossing techniques
- Explore jitter and its effects on timing
- Investigate spread-spectrum clocking
- Learn about metastability in digital circuits
Course Navigation:
← Previous: Chapter 12 - Parity Bits | Next: Chapter 14 - Transmission Types