It depends on peripherals and program………
We usually use a crystal oscillator for generating clock of a microcontroller… or we can use the internal RC oscillator available with some microcontrollers…. The frequency of this clock is termed as Fosc …
But some microcontrollers have internal PLL, thus by using it we can multiply the crystal or RC oscillator frequency to a large value…. In this case Fosc is the resultant frequency…
While using some peripherals like timers you can divide this Fosc by using prescalar by writing appropriate registers…
Is the frequency divided within the microcontroller?
Connect a pin of the microcontroller to a piezoelectric speaker or an ordinary speaker (voltage and current ratings should be considered while connecting an ordinary speaker). Then you can generate a tone of particular frequency by making the pin high and low in that frequency.
MikroC Pro for PIC Microcontrollers provides built in library routines for tone generation…………
How can we generate musical tones with a microcontroller ? I am using PIC 16F877A
😕
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.
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 :
> Accurate
> 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.
Why crystal oscillators are preferred with microcontrollers?
What is the need of it?
Can we use other oscillators?