Oscillators are used to provide clock to the microcontroller. In a microcontroller or microprocessor, every instruction is executed in synchronization with clock. It provides timing for different operations in a microcontroller.
It is not necessary to use crystal oscillators, in fact we may use other oscillators. It depends on the application.
Crystal Oscillators are preferred because of the following reasons :
> Can be used for high frequency generation
> Low Cost
> Small in Size
> Low Power Consumption
Nowadays many microcontrollers have internal RC oscillators, it can be used if precision is not important. Usually these internal RC oscillators cannot generate higher frequency clocks.
Oscillators provide the basic timing and control for a microcontroller and its peripherals.
Commonly used oscillators are of crystal because of its well known stability and durability. It produces stable output for prolonged time. Crystal oscillators are mainly works under the principle of Piezo electric effect.