Clock and RESET Circuits
Learning Goals
- Explain the oscillator circuit architecture in the 8051 microcontroller
- Understand why quartz crystals are preferred over resonators for clock generation in 8051 systems
- Analyze the reasons resonators are not preferred: stability issues, limited frequency range (cannot support >12 MHz reliably), negligible cost savings relative to total board cost
- Describe the clock divider circuit that generates machine cycles from the crystal frequency (12 oscillator periods = 1 machine cycle)
- Understand the RESET circuit operation and its role in initializing the microcontroller
- Explain the default initial states of registers after RESET, particularly Stack Pointer (SP = 07H)
- Differentiate clock connections between HMOS and CHMOS/CMOS versions of 8051 (XTAL1 and XTAL2 pins)
- Apply timing analysis to design oscillator circuits meeting 8051 specifications
In the 8051 microcontroller, the clock circuit provides the timing reference for CPU operation, instruction execution, timers, and serial communication, while the RESET circuit forces the device into a known startup state before normal execution begins at program address 2. The original MCS-51 architecture uses an on-chip oscillator amplifier connected through the XTAL1 and XTAL2 pins, typically with an external quartz crystal and two capacitors to ground 2. A key architectural fact is that the classic 8051 derives one machine cycle from 12 oscillator periods, so at 12 MHz, one machine cycle is . This timing relationship is central to instruction timing, timer design, and baud-rate generation 2.
Quartz crystals are generally preferred over ceramic resonators in precise 8051 systems because crystals provide substantially better frequency accuracy and long-term stability, especially across temperature and voltage changes 2. In educational and practical 8051 boards, resonators are often considered less desirable because their stability is poorer, their usable high-frequency behavior is less predictable, and the cost advantage is usually minor compared with the total board cost 2. For many classic 8051 applications, oscillator choices such as 11.0592 MHz and 12 MHz are especially common because they align well with machine-cycle timing and serial baud-rate generation 2.
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩ ↩2 ↩3 ↩4 ↩5
-
AT89 Series Hardware Description - Datasheet documentation for reset operation, reset pulse considerations, and SFR reset values including SP = 07H. ↩ ↩2
-
AT89C51RC Data Sheet - Confirms timer counting by machine cycle and standard 12-oscillator-period timing in classic-compatible devices. ↩
-
Using Crystal Oscillators with MSC12xx MicroSystem Products - Application note explaining quartz-crystal stability, load effects, and oscillator-design considerations. ↩ ↩2
-
Abracon Oscillator and Resonator Application Notes - Reference for comparative frequency stability characteristics of quartz crystals and ceramic resonators. ↩ ↩2
-
8051 Oscillator Circuits: The Heartbeat of Your Microcontroller - Practical overview of common 8051 oscillator choices, load-capacitance estimation, and the significance of 11.0592 MHz. ↩
Timing and Reset Circuit of 8051
Core Timing Rule
For the classic 8051 architecture, 1 machine cycle = 12 oscillator periods. Therefore, and 2.
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩
-
AT89C51RC Data Sheet - Confirms timer counting by machine cycle and standard 12-oscillator-period timing in classic-compatible devices. ↩
1. Oscillator Circuit Architecture of the 8051
The 8051 includes an internal inverting amplifier that allows an external frequency-determining element to form the clock source 2. In the most common arrangement, a quartz crystal is connected between XTAL1 and XTAL2, and each side is tied to ground through a small capacitor 2. This forms a stable resonant network that feeds the internal oscillator. The resulting oscillator output is not used directly by the CPU; instead, it is processed by internal timing logic that divides the signal into states and machine cycles .
The Intel MCS-51 documentation describes a machine cycle as a sequence of 6 states labeled through , with each state lasting 2 oscillator periods, giving a total of 12 oscillator periods per machine cycle . Thus, if
then
and
This timing model explains why classic 8051 instruction timings are often specified in machine cycles rather than raw clock cycles .
A typical crystal connection is conceptually:
The exact capacitor values depend on the crystal load-capacitance requirement and board parasitics, but small capacitors in the tens of picofarads are common in practice 2.
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩ ↩2 ↩3 ↩4 ↩5
-
AT89 Series Hardware Description - Datasheet documentation for reset operation, reset pulse considerations, and SFR reset values including SP = 07H. ↩ ↩2 ↩3
-
8051 Oscillator Circuits: The Heartbeat of Your Microcontroller - Practical overview of common 8051 oscillator choices, load-capacitance estimation, and the significance of 11.0592 MHz. ↩
How the 8051 Generates Its Internal Timing
- 1Step 1
The external quartz crystal or resonator works with the on-chip oscillator amplifier connected at XTAL1 and XTAL2 to generate a stable periodic signal 2.
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩
-
AT89 Series Hardware Description - Datasheet documentation for reset operation, reset pulse considerations, and SFR reset values including SP = 07H. ↩
-
- 2Step 2
The resonant element determines the oscillation frequency, such as 12 MHz or 11.0592 MHz, subject to component tolerance and loading conditions 3.
Footnotes
-
AT89 Series Hardware Description - Datasheet documentation for reset operation, reset pulse considerations, and SFR reset values including SP = 07H. ↩
-
Using Crystal Oscillators with MSC12xx MicroSystem Products - Application note explaining quartz-crystal stability, load effects, and oscillator-design considerations. ↩
-
8051 Oscillator Circuits: The Heartbeat of Your Microcontroller - Practical overview of common 8051 oscillator choices, load-capacitance estimation, and the significance of 11.0592 MHz. ↩
-
- 3Step 3
The internal clock generator divides timing into 6 states per machine cycle, and each state occupies 2 oscillator periods .
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩
-
- 4Step 4
Because 6 states × 2 oscillator periods/state = 12 oscillator periods, one machine cycle equals 12 oscillator periods in the standard 8051 timing model 2.
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩
-
AT89C51RC Data Sheet - Confirms timer counting by machine cycle and standard 12-oscillator-period timing in classic-compatible devices. ↩
-
- 5Step 5
Instruction execution, timer increment behavior, bus timing, and several peripheral operations are synchronized to these machine-cycle-derived internal timings 2.
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩
-
AT89C51RC Data Sheet - Confirms timer counting by machine cycle and standard 12-oscillator-period timing in classic-compatible devices. ↩
-
2. Why Quartz Crystals Are Preferred Over Ceramic Resonators
Quartz crystals are preferred in 8051 systems whenever timing precision matters because they offer better frequency tolerance, better stability over temperature, and lower long-term drift than ceramic resonators 2. Quartz resonators are commonly specified in ppm, whereas ceramic resonators are often specified in percent, reflecting a much larger permissible variation 2. For a microcontroller architecture whose timers, instruction timing, and UART baud rates all depend on clock accuracy, this difference is highly significant 2.
The practical reasons crystals are favored in 8051 teaching and design contexts include:
- Stability issues with resonators: Ceramic resonators drift more with temperature, component aging, and load-capacitance mismatch than quartz crystals 2.
- Limited reliable higher-frequency use in many traditional 8051 educational designs: While resonators do exist over a range of frequencies, they are generally less favored where a stable, precise clock near or above common classic 8051 operating points is needed; crystals are the more robust choice for reliable timing-sensitive operation 2.
- Minimal cost advantage: The price difference between a resonator and a crystal is small relative to the total cost of a microcontroller board, power supply, connectors, PCB, and support components 2.
- Baud-rate accuracy: Frequencies like 11.0592 MHz are chosen specifically because they divide cleanly for standard serial communication rates in the 8051 UART timing chain .
In short, a ceramic resonator may be acceptable for noncritical timing, but a quartz crystal is the academically correct and professionally safer recommendation for the 8051 in most instructional and embedded-system designs 3.
Footnotes
-
Using Crystal Oscillators with MSC12xx MicroSystem Products - Application note explaining quartz-crystal stability, load effects, and oscillator-design considerations. ↩ ↩2 ↩3 ↩4 ↩5
-
Abracon Oscillator and Resonator Application Notes - Reference for comparative frequency stability characteristics of quartz crystals and ceramic resonators. ↩ ↩2 ↩3 ↩4 ↩5
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩ ↩2
-
8051 Oscillator Circuits: The Heartbeat of Your Microcontroller - Practical overview of common 8051 oscillator choices, load-capacitance estimation, and the significance of 11.0592 MHz. ↩ ↩2 ↩3 ↩4
Why Resonators Are Commonly Not Preferred
In 8051 designs that depend on accurate timer intervals or UART baud rates, ceramic resonators are often avoided because their frequency stability is poorer than quartz crystals, and the small cost savings rarely justify the timing uncertainty 3.
Footnotes
-
Using Crystal Oscillators with MSC12xx MicroSystem Products - Application note explaining quartz-crystal stability, load effects, and oscillator-design considerations. ↩
-
Abracon Oscillator and Resonator Application Notes - Reference for comparative frequency stability characteristics of quartz crystals and ceramic resonators. ↩
-
8051 Oscillator Circuits: The Heartbeat of Your Microcontroller - Practical overview of common 8051 oscillator choices, load-capacitance estimation, and the significance of 11.0592 MHz. ↩
Crystal vs Resonator for 8051 Design Priorities
Qualitative comparison based on timing-oriented 8051 design considerations [^4][^5][^6].
3. Clock Divider and Machine-Cycle Timing Analysis
The classic 8051 timing chain can be summarized mathematically as 2:
and
This is the central equation for timing analysis. A few useful examples are:
| Oscillator Frequency | Machine-Cycle Frequency | Machine-Cycle Period |
|---|---|---|
| 6 MHz | 0.5 MHz | 2.0 s |
| 11.0592 MHz | 0.9216 MHz | 1.085 s |
| 12 MHz | 1.0 MHz | 1.0 s |
At 11.0592 MHz, the machine-cycle frequency becomes:
This value is especially useful because the UART baud-rate generation path can derive common standard baud rates accurately from it . At 12 MHz, the timing becomes simpler for instruction-time calculations because each machine cycle is exactly .
This divider-based architecture also affects timers. In the standard 8051, timers operating as timers increment once per machine cycle, not once per raw oscillator cycle . Hence, timing calculations must always begin with the divided machine-cycle clock unless the device documentation states otherwise for enhanced derivatives .
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩ ↩2
-
AT89C51RC Data Sheet - Confirms timer counting by machine cycle and standard 12-oscillator-period timing in classic-compatible devices. ↩ ↩2 ↩3
-
8051 Oscillator Circuits: The Heartbeat of Your Microcontroller - Practical overview of common 8051 oscillator choices, load-capacitance estimation, and the significance of 11.0592 MHz. ↩
Timing Analysis for Choosing an 8051 Oscillator
- 1Step 1
Determine whether the design prioritizes instruction timing simplicity, UART baud-rate accuracy, timer precision, or maximum supported operating frequency from the selected 8051 device datasheet 3.
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩
-
AT89 Series Hardware Description - Datasheet documentation for reset operation, reset pulse considerations, and SFR reset values including SP = 07H. ↩
-
8051 Oscillator Circuits: The Heartbeat of Your Microcontroller - Practical overview of common 8051 oscillator choices, load-capacitance estimation, and the significance of 11.0592 MHz. ↩
-
- 2Step 2
Common classic choices are 12 MHz for easy timing arithmetic and 11.0592 MHz for accurate serial baud-rate generation 2.
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩
-
8051 Oscillator Circuits: The Heartbeat of Your Microcontroller - Practical overview of common 8051 oscillator choices, load-capacitance estimation, and the significance of 11.0592 MHz. ↩
-
- 3Step 3
Use for the standard 8051 architecture to determine the effective timing base for instructions and timers 2.
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩
-
AT89C51RC Data Sheet - Confirms timer counting by machine cycle and standard 12-oscillator-period timing in classic-compatible devices. ↩
-
- 4Step 4
Use to convert the oscillator frequency into the time base used by the CPU core .
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩
-
- 5Step 5
Ensure the oscillator has enough startup and stabilization time before the RESET signal is released, because reset must remain active long enough for the oscillator to restart and stabilize .
Footnotes
-
AT89 Series Hardware Description - Datasheet documentation for reset operation, reset pulse considerations, and SFR reset values including SP = 07H. ↩
-
- 6Step 6
Select crystal load capacitors that are compatible with the crystal specification and include the effect of MCU input capacitance and PCB stray capacitance 2.
Footnotes
-
Using Crystal Oscillators with MSC12xx MicroSystem Products - Application note explaining quartz-crystal stability, load effects, and oscillator-design considerations. ↩
-
8051 Oscillator Circuits: The Heartbeat of Your Microcontroller - Practical overview of common 8051 oscillator choices, load-capacitance estimation, and the significance of 11.0592 MHz. ↩
-
A 12 MHz crystal gives , which makes timing calculations straightforward in teaching, timer delays, and instruction analysis .
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩
4. XTAL1 and XTAL2 Connections: HMOS vs CHMOS/CMOS 8051 Variants
A subtle but important architectural detail is that the external-clock drive pin differs between process families. Intel’s MCS-51 documentation states that when an external oscillator signal is used instead of a crystal network :
- In HMOS devices such as the original 8051, the signal at XTAL2 drives the internal clock generator .
- In CHMOS devices such as 80C51-family variants, the signal at XTAL1 drives the internal clock generator .
This distinction matters when a designer uses an external clock source rather than a crystal directly across XTAL1 and XTAL2. If only one pin is actively driven, the correct pin must be chosen according to the specific device family .
For the standard crystal-connected arrangement, the crystal is placed across both pins as shown in the manufacturer’s oscillator diagrams 2. But for externally supplied clock signals, always consult the exact datasheet because modern 8051 derivatives can vary 2.
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7
-
AT89 Series Hardware Description - Datasheet documentation for reset operation, reset pulse considerations, and SFR reset values including SP = 07H. ↩ ↩2
-
AT89C51RC Data Sheet - Confirms timer counting by machine cycle and standard 12-oscillator-period timing in classic-compatible devices. ↩
Exam-Oriented Distinction
Remember this contrast: in HMOS 8051 parts, external clock drive is applied to XTAL2; in CHMOS/CMOS 80C51 parts, it is applied to XTAL1 .
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩
5. RESET Circuit Operation in the 8051
The RESET input forces the microcontroller into a defined initial condition so that execution begins predictably 2. After a valid reset, the Program Counter (PC) is set to 0000H, causing execution to begin from the reset vector 2. The reset mechanism initializes the special function registers to documented values, though the internal RAM is generally not cleared by reset and may remain indeterminate after power-up .
A common power-on reset circuit uses an RC network connected to the RST pin. On power-up, the capacitor momentarily causes the reset input to remain active long enough to initialize the device and allow the oscillator to stabilize; afterward, the resistor discharges or biases the node so reset becomes inactive . Datasheet guidance emphasizes that reset must be held active long enough for the oscillator to restart and stabilize before normal execution resumes .
Conceptually:
The exact active level and pulse-width requirements must be checked against the chosen device datasheet, but the standard instructional interpretation is that a sufficiently long reset pulse places the 8051 in its startup state 2.
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩ ↩2 ↩3
-
AT89 Series Hardware Description - Datasheet documentation for reset operation, reset pulse considerations, and SFR reset values including SP = 07H. ↩ ↩2 ↩3 ↩4 ↩5 ↩6
What Happens During RESET
- 1Step 1
The RST pin is driven to its active reset condition by a power-on RC network, pushbutton circuit, watchdog event, or other reset source 2.
Footnotes
-
AT89 Series Hardware Description - Datasheet documentation for reset operation, reset pulse considerations, and SFR reset values including SP = 07H. ↩
-
AT89C51RC Data Sheet - Confirms timer counting by machine cycle and standard 12-oscillator-period timing in classic-compatible devices. ↩
-
- 2Step 2
The reset process forces the CPU and major control registers into documented startup values, preparing the device for deterministic execution 2.
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩
-
AT89 Series Hardware Description - Datasheet documentation for reset operation, reset pulse considerations, and SFR reset values including SP = 07H. ↩
-
- 3Step 3
Execution is redirected to address 0000H, which is the reset vector for the 8051 architecture 2.
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩
-
AT89 Series Hardware Description - Datasheet documentation for reset operation, reset pulse considerations, and SFR reset values including SP = 07H. ↩
-
- 4Step 4
The Stack Pointer is set to 07H after reset, so the first PUSH operation will use location 08H 2.
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩
-
AT89 Series Hardware Description - Datasheet documentation for reset operation, reset pulse considerations, and SFR reset values including SP = 07H. ↩
-
- 5Step 5
Port latches typically initialize to FFH, many control SFRs initialize to 00H, and some fields may be documented as undefined or device-dependent 2.
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩
-
AT89 Series Hardware Description - Datasheet documentation for reset operation, reset pulse considerations, and SFR reset values including SP = 07H. ↩
-
- 6Step 6
When reset is released and the clock is stable, the CPU starts executing from the reset vector .
Footnotes
-
AT89 Series Hardware Description - Datasheet documentation for reset operation, reset pulse considerations, and SFR reset values including SP = 07H. ↩
-
6. Default Register States After RESET
One of the most testable aspects of the 8051 reset sequence is the default register map. According to Intel MCS-51 and Atmel AT89C51 documentation, reset writes defined values to most SFRs, while some values are undefined or device dependent 2.
Important defaults include:
- PC = 0000H
- ACC = 00H
- B = 00H
- PSW = 00H 2
- SP = 07H 2
- DPTR = 0000H
- P0, P1, P2, P3 = FFH (port latches high) 2
- TMOD = 00H, TCON = 00H, timer registers cleared 2
- SCON = 00H 2
- SBUF = indeterminate on some variants
- Internal RAM not cleared by reset
The value SP = 07H deserves special attention. Since register bank 0 occupies addresses through , a reset places the stack pointer at , and the first push increments it to . This means the stack begins just above register bank 0 unless the programmer relocates it. If additional register banks or lower RAM data are needed, software should explicitly move the stack to a safer RAM region .
Footnotes
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8
-
AT89 Series Hardware Description - Datasheet documentation for reset operation, reset pulse considerations, and SFR reset values including SP = 07H. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10 ↩11 ↩12
Common Clarifications and Edge Cases
7. Designing an 8051 Oscillator Circuit to Meet Specifications
To design an oscillator circuit correctly, the engineer must match the resonant component and load network to the microcontroller and application timing requirements 2. The main design checks are:
- Frequency target: Choose a crystal frequency allowed by the selected 8051 device .
- Machine-cycle implications: Verify that the resulting machine-cycle time supports instruction throughput and timer intervals 2.
- UART timing: If serial communication is required, verify that the oscillator frequency supports low-error baud-rate generation; 11.0592 MHz is a classic choice .
- Load capacitance: Match external capacitors so the crystal sees approximately its specified load capacitance after considering board and MCU parasitics 2.
- Startup margin: Ensure the reset circuit keeps the MCU in reset long enough for oscillator startup .
- Technology-family pin behavior: For external clock injection, apply the signal to XTAL2 on HMOS and XTAL1 on CHMOS/CMOS versions as documented .
A simplified crystal-load relation often used by designers is :
If ,
So if the crystal requires a certain load capacitance, the external capacitor values must be chosen accordingly after accounting for stray and input capacitances 2.
Footnotes
-
AT89 Series Hardware Description - Datasheet documentation for reset operation, reset pulse considerations, and SFR reset values including SP = 07H. ↩ ↩2 ↩3
-
Using Crystal Oscillators with MSC12xx MicroSystem Products - Application note explaining quartz-crystal stability, load effects, and oscillator-design considerations. ↩ ↩2 ↩3
-
Intel MCS-51 Microcontroller Family User's Manual - Primary architectural reference for machine cycles, oscillator usage, external clock pin differences, and reset-state behavior. ↩ ↩2
-
AT89C51RC Data Sheet - Confirms timer counting by machine cycle and standard 12-oscillator-period timing in classic-compatible devices. ↩
-
8051 Oscillator Circuits: The Heartbeat of Your Microcontroller - Practical overview of common 8051 oscillator choices, load-capacitance estimation, and the significance of 11.0592 MHz. ↩ ↩2 ↩3 ↩4
Do Not Ignore Device Variants
Many modern 8051-compatible devices retain the architectural model but alter timing behavior, maximum frequency, or clock-divider options. Always verify whether your part uses the classic 12-clock machine cycle or an enhanced mode such as X2 .
Footnotes
-
AT89C51RC Data Sheet - Confirms timer counting by machine cycle and standard 12-oscillator-period timing in classic-compatible devices. ↩
Knowledge Check
In the classic 8051 architecture, one machine cycle corresponds to how many oscillator periods?