Crystal oscillators, also known as crystal oscillators, are usually divided into two types: active crystal oscillators and passive crystal oscillators. Passive crystal oscillators are generally called crystals, while active oscillators are called oscillators. From the name of the crystal oscillator, it can be known that it is destined to oscillate constantly.

The single-chip microcomputer is a complex synchronous sequential circuit. In order to ensure the realization of the synchronous mode, the circuit should work strictly according to the sequential order under the control of a unique clock signal. The function of the crystal oscillator is to provide the reference clock signal for the single-chip system, similar to the instructor who shouts the password during the army training, and all the soldiers complete the response action under the command of the instructor. All the work inside the microcontroller is based on this clock signal to work. The circuit used to generate the clock signal required for the operation of the single-chip microcomputer is the clock circuit.

There is a high-gain inverting oscillator inside the STC89C52 microcontroller. Its input pin is 19-pin XTAL1, and its output pin is 18-pin XTAL2. As long as the crystal oscillator is connected between these two pins, the external The two starting capacitors are generally about 30pf, which can form a stable self-excited oscillator.

For STC microcontroller, the crystal frequency range is generally 1.2MHZ~12MHZ. The higher the crystal oscillation frequency, the higher the system clock frequency, and the faster the speed of the microcontroller. Usually, the frequency of the crystal oscillator is 6MHZ or 12MHZ. If the serial communication of the single-chip microcomputer is used in the system, the crystal oscillator with the oscillation frequency of 11.0592MHZ is generally used, which oscillates 11059200 times per second.

The single-chip microcomputer works according to the timing sequence. There are four timing concepts about the MCS-51 series single-chip microcomputer, which can be explained by timing units. From small to large, they are: beat, state, machine cycle and instruction cycle. The period of the oscillation pulse is defined as the beat, represented by P, which is the oscillation frequency fosc of the crystal oscillator. After the oscillating pulse fosc is divided by two, it is the cycle of the single-chip clock signal, which is defined as a state, represented by S. A state contains two beats, the beat corresponding to the first half cycle is called P1, and the beat corresponding to the second half cycle is called P2. MCS-51 series single-chip microcomputer adopts timing control mode and has a fixed machine cycle. It is stipulated that the width of one machine cycle is 6 states, that is, 12 oscillation pulse cycles, so the machine cycle is the twelve-frequency division of the oscillation pulse.

For example, when the oscillation pulse frequency is 12 MHz, one machine cycle is 1µs; when the oscillation pulse frequency is 6MHz, one machine cycle is 2µs. The instruction cycle is the largest sequential timing unit, that is, the time required to execute an instruction. It generally consists of several machine cycles. Different instructions require different machine cycles. Usually an instruction that contains one machine cycle is called a single-cycle instruction, an instruction that contains two machine cycles is called a two-cycle instruction, and so on. Another thing to note is that the “instructions” here refer to assembly instructions, not C language programs.

Reviewing Editor: Liu Qing

Leave a Reply

Your email address will not be published.