It is said that 8051 has an on-chip oscillator but requires external clock to run it. What may be the internal circuit for on-chip oscillator, how it runs after connecting crystal oscillator? Also what is the purpose of external capacitor with crystal oscillator?
No.
There is no on-chip oscillator in standard 8051 architecture.
It is written in some books, I really don't know about it. Would you like to share about clocking of 8051 ?
Don't talk about "8051". Talk about a specific chip. Because specific chips from specific manufacturers will differ from each other.
Your current question is a bit like "how fast is a car?" or "is three wheels better than two?"
I think you mean, "the 8051 has an on-chip oscillator but requires an external crystal"?
In other words, the amplifiers, etc, are on the chip, but you need to add an external crystal to make it run at the frequency you require.
This is not unusaal to any microcontroller.
Some can also run with a ceramic resonator instead of a crystal.
Many (most?) can also be driven from an external clock source.
As already noted, the Datasheet for the particular chip will give you specific details.
None of this has anything to do with Keil!
Lomas Subedi - You have misunderstood.
The books say - "The 8051 has an on-chip clock generation circuit" and not 8051 has on-chip oscillator . The 8051 based architecture chips have on-chip clock generation circuit.
It simply means that there is a Mod-12 counter. The externally applied clock signal (which may be given from a function generator, crystal oscillator or RC oscillator, though crystal oscillator is preferred) will be divide by 12 and then applied to the CPU.
NOTE: The external oscillators (are ac circuits & not digital in nature) may not generate pure square wave(digital signal), i.e. the generated signal may have noise(ac component). Hence a counter is used. The output of this counter will be a square wave signal with frequency = osc. freq/12
The 12-clock feature of the original 8051 isn't to remove any noise. The crystal have two pins - you drive on one pin, and read back on the other pin. The read-back is a weak analog signal that will be processed to both generate the drive signal for the first crystal pin and generate the square wave for internal clocking.
That the chip have 12-clock logic is because it implements a state machine, where some of the 12 cycles are used for setting address pins, some for fetching instruction, some for decoding, ... By only using one phase of the input signal, it doesn't matter so much that the oscillator circuit will not manage a perfect 50% duty cycle.
More advanced processor cores do more things concurrently, where you have many instructions processed at the same time, but at different phases. So one instruction may be fetched while the next one is decoded and a third one is being executed. But it is a much more advanced design to have a pipeline where multiple instructions flows through the processor. The 8051 is very old, and made with a minimum of transistors. So one instruction is handled at a time, and the processor needs a large number of clock cycles to sequence all the "book keeping" for that single instruction.
Since the processor have two oscillator pins - one output for driving the crystal, and one input for reading back - it is possible to skip the processor pin that drives a crystal. Instead, an external oscillator module can be connected to the crystal input pin.
Many (most?) modern 8051 derivatives take less than 12 clocks per instruction.
Again, see the datasheet for the particular chip for specific details
NO, NO!! the '51 has an internal oscillator that requires an external crystal to function. there is no requirement for "a function generator, crystal oscillator or RC oscillator". some modern derivatives can even run (while not as precisely clocked) without a crystal.
The traditional 8051 is very old, and made with a minimum of transistors. So one instruction is handled at a time, and the processor needs a large number of clock cycles to sequence all the "book keeping" for that single instruction. this is not true for most modern derivatives
Erik
"this is not true for most modern derivatives"
Which is why I started my post with the sentence "The 12-clock feature of the original 8051 isn't to remove any noise." (emphasis on "original" added now)
Today, transistors are almost free. With a design where the inner transistors are very small and just the I/O transistors are scaled large for protection and current drive capability, the transistors consumes very little space and requires very little power. So no longer a need for long sequence machines just to process a single instruction.
Smaller transistors also means less capacitance and shorter travel distance for the signals, so there are less need for wait states for data to travel around the chips.
I mean, for what Crystal quartz is required to run internal oscillator? ... The specific chip I'm talking about is AT89C51 because that is the way the oscillator circuit in the chip is designed.
The book clearly mentions that The 8051 has an on-chip oscillator but requires an external clock to run it.
To go into more details, i think you need to refer to operating principle of Oscillators. Just high-lighting few points here: Oscillators are the closed loop circuits that generate sustained output oscillations of a constant frequency (as per the theory). But there is an AC noise signal present at the input which is actually being amplified using feedback(oscillators have gain slightly more than 1) and the output frequency depends upon the resonant circuit(combination of R/L/C).
So the point is, even an oscillator requires an input signal. In the TTL oscillator circuit, the terminals of the component pick up the ac noise, which is amplified and fedback to the input. But in an IC, where the circuit is integrated, no input will be present for the oscillator circuit. Hence a external crystal or an RC oscillator is required.
An IC can manage quite well without having any external crystal or RC oscillator.
While a TTL circuit can oscillate without any noise. An inverter can be designed to always power up with the output in a fixed state - but if that output is connected to the input, the chip will then see a reason to invert. So toggle the output. Which will again make it see a reason to invert, and toggle the output. The timing here controlled by the delay in the TTL logic.
The crystal is there to define the oscillating frequency, just because a crystal is extremely exact (at least when compared to an RC circuit). Chips with internal RC oscillators can manage well enough for UART communication by having the internal RC components laser-trimmed to better than 0.5% precision.
An oscillator obviously need an amplitude larger than 1. But depending on design, it needn't be close to 1. The TTL inverter have an amplification that is way much more than 1. It's just that the amplification needs to happen in a bandwidth span where you the phase change between in and out is enough.
Back to noise - for lots of crystal oscillators, noise is the only way that makes the crystal start to spin up the oscillation. And that is why some processors may fail badly to start the oscillator with some crystals or with some power-up speeds. So with a slow power-up, the drive pin can slowly ramp op the signal but there isn't enough signal seen on the oscillator input pin to magnify and feed back.
Another issue is of course that a crystal may oscillate at the fundamental frequency - but can also have overtone oscillation. So burden capacitors and filtering of the input signal can result in a circuit that always locks onto the same frequency. Or sometimes starts with fundamental and sometimes overtone frequency.
"The 8051 has an on-chip oscillator but requires an external clock to run it"
That is wrong.
The on-chip oscillator most certainly can (and, very often, does) run without an external clock!
In fact, I would suspect that most 8051 applications use just a crystal and do not use an external clock?
A crystal (as explained in my earlier link) simply provides the resonant element for the internal oscillator circuit.
The internal circuit is designed to ensure that it will start oscillating. The specific device Datasheet will contain details of how long to allow for the oscillations to become stable...
In fact, I would suspect that most 8051 applications use just a crystal and do not use an external clock Depends on the manufacturer and IC. (refer to the respective datasheet).
The original 8051 architecture was designed such that crystal or RC oscillator or an external clock generation circuit can be used as clock input to 8051.
The specific device Datasheet will contain details of how long to allow for the oscillations to become stable... The reference text books explaining the 8051 architecture don't contain any such topic or even a Note mentioning this. And the OP is a newbie, may be a student who has just started studying from the book (he has posted the link).
.
In the TTL oscillator circuit, the terminals of the component pick up the ac noise, which is amplified and fedback to the input.
Meant RC Oscillator and not TTL. Note was about the RC oscillators which are AC circuits.
An oscillator obviously need an amplitude larger than 1. But depending on design, it needn't be close to 1. The TTL inverter have an amplification that is way much more than 1.
oscillators have gain slightly more than 1. The amplitude must be definitely more than 1 (if units is Volts)
"The original 8051 architecture was designed such that crystal, or RC oscillator, or an external clock generation circuit can be used as clock input to 8051"
Yes. Exactly.
So it is incorrect to say that it requires an external clock to run it.
Sure, an external clock can be used, but it is not required.
That was my point.
"RC oscillators ... are AC circuits"
As is a crystal oscillator - the crystal provides the resonant element, as does the RC in an RC oscillator.