I'm trying to design an 8051 microcontroller circuit which uses timers/counters, and the circuit I'm using for inspiration uses a clock generated using the XTAL1 and XTAL2 pins of the IC, shown in the picture.

What I don't understand is why this clock is necessary for using the counter function of the IC, and where the output of the clock goes. I tried using a logic probe to test where the clock was outputted but couldn't figure it out.

  • 3
    \$\begingroup\$ Usually when a microprocessor has pins for connecting a timing crystal like this they're for generating the clock that entire microprocessor runs on it. That is, the crystal determines the speed the CPU runs at. \$\endgroup\$
    – Ross Ridge
    Commented Feb 10, 2019 at 19:23
  • \$\begingroup\$ MCUs are synchronous logic - the clock is the "metronome beat" on which everything happens, most things taking many beats to accomplish. Your timers effectively divide this clock by counting cycles of it... \$\endgroup\$ Commented Feb 10, 2019 at 22:50
  • \$\begingroup\$ The crystal might be optional for some microprocessors that have internal clocks, which is why you can sometimes see reference circuits with and without them for the same IC, but these oscillators are too imprecise as a frequency reference, so you can derive neither system clocks nor protocol timings from them — all they are good for is to run the CPU at roughly the correct speed. \$\endgroup\$ Commented Feb 10, 2019 at 22:53
  • \$\begingroup\$ it is unclear what you are designing ..... what is your understanding of the 8051? .... what do you think that it is? \$\endgroup\$
    – jsotola
    Commented Feb 10, 2019 at 23:09

1 Answer 1


The MCU processor requires a clock to do (almost) anything. Aside from perhaps the RST input which is probably partially asynchronous, everything happens after some number of clock edges.

None of the code will run without a clock, so, for example, the timer module cannot be set up without a clock and some code.

The 8051 is a rather old microcontroller and requires an external clock (either a pulse train or there is an internal oscillator which can use a bare crystal). Some relatively newer processors may have an internal RC clock, as an option or perhaps as the only clock source.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.