General learning of single chip microcomputer - what is a clock?

What is a clock?

The clock is the smallest unit of time to synchronize the working timing of each component of the single-chip microcomputer system. The clock is controlled by the CPU to generate other synchronous control signals that maintain a certain relationship with the clock to coordinate the working timing of each component. Without a clock, the system will collapse.

For example, when CPU and memory (RAM) transmit data, signals such as address (A0 ~ Ax), data (D0 ~ Dx), read/write (R/W) must appear on their respective buses according to a certain timing.

How is the clock in the microcontroller generated?

The clock in the microcontroller is generated using a crystal oscillator

After the crystal oscillator is energized, the original clock frequency is generated. The clock frequency is enlarged or reduced to generate different bus frequencies. The crystal oscillator itself is mechanically vibrated by power-on, but the resonant circuit composed of inductance and capacitance is the continuous conversion of the electric field and the magnetic field, and this frequency is Fixed, the output is a pulse signal with a fixed frequency, and the quartz clock uses this fixed frequency to time. The crystal oscillator can convert DC power into AC power with a certain frequency.

What are the clock classifications?

Internal clock:

        It is generally used to enhance the computing power of the chip. Generally, the internal clock is faster than the external clock and can be set.

        External clocks need to use clocks like 11.0592M, 22,1184M

        For usb transmission, generally use clocks like 6M, 12M, 48M, 96M

        f has low precision, is greatly affected by temperature, and has low cost. It can be used when serial communication is not involved and precision requirements are not high.

External clock:

        External clock is generally used for communication-related settings

         fHigh precision, little influence by temperature, low power consumption

How to choose the clock?

  1. First go to the data sheet to determine the system clock frequency supported by the microcontroller
  2. Then go to the user manual to find the clock architecture diagram of the microcontroller
  3. Detailed analysis of the clock source of the architecture diagram
  4. Detailed analysis of the clock output of the architecture diagram
  5. Corresponding to different peripherals, you can configure different registers

What is a clock cycle?

The clock period is also called the oscillation period and is defined as the reciprocal of the clock pulses.

The clock period is the reciprocal of the external crystal oscillator of the microcontroller, for example, the 12M crystal oscillator has a clock period of 1/12us.

The data booklet can quickly provide the peripherals supported by the microcontroller and the data information of the memory, which is convenient for us to quickly refer to

User Manual, a detailed explanation of the data sheet, which part and how to use it, and a detailed explanation of the principle!

Guess you like

Origin blog.csdn.net/m0_68021259/article/details/132601383