Electrical – the XTAL clock used for in an 8051 microntroller

8051assemblymicrocontroller

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.

Best Answer

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.