What is the role of crystal oscillator in single chip microcomputer?

Last Update Time: 2019-07-23 13:53:53

Simply put, without a crystal oscillator, there is no clock cycle, no clock cycle, the program code cannot be executed, and the microcontroller cannot work.

When the microcontroller is working, the instructions are taken from the RoM one by one, and then executed step by step. The time that the microcontroller accesses the memory is called a machine cycle, which is a time base. A machine cycle consists of 12 clock cycles. If a microcontroller selects a 12MHz crystal, its clock period is 1/12μs, and its one machine cycle is 12×(1/12)μs, which is 1μs.

Microcontroller: ATTINY10-TSHR



Some of the MCS microcontroller instructions are faster to complete, as long as one machine cycle is on the line, some are more complete, two machine cycles are required, and two instructions require four machine cycles. In order to measure the length of instruction execution time, a new concept is introduced: the instruction cycle. The so-called instruction cycle refers to the time when an instruction is executed. For example, when you need to calculate the time required for the DJNZ instruction to complete, you must first know the frequency of the crystal. If the crystal used is 12MHz, then one machine cycle is 1us. The DJNZ instruction is a two-cycle instruction, so it takes 2us to execute once. If the instruction needs to be executed 500 times, it is exactly 1000μs, which is 1ms.


The machine cycle is not only important for command execution, but the machine cycle is also the time base for the microcontroller timer and counter. For example, if a single chip selects a 12MHz crystal oscillator, then when the value of the timer is increased by 1, the actual elapsed time is 1us, which is the timing principle of the microcontroller.


If you want to know more, our website has product specifications for crystal oscillator, you can go to ALLICDATA ELECTRONICS LIMITED to get more information.