Continue to Site

Confusion about microconroller oscillators ?

Status
Not open for further replies.

agnivesh

Member level 2
Member level 2
Joined
Apr 24, 2004
Messages
45
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Location
UK
Activity points
549
Please answer the following querries :

1. Why do we need an oscillator in a Micro Conroller Unit (MCU) ?

2. Is there anything like internal and external oscillators ? what's the main differences in both and why do we need both ? why can't we use only internal one if there exists one ?

3. what do we mean by "4 MHz MCU", "8 MHz MCU", etc. ? Can we vary the clock speed (are clock speed and oscillator frequecy the same thing ?) of an MCU, if yes, then what's the minimum and maximum limit for that ?

4. how the timers measure time difference between events, for example, how the timers know the time difference between two events is 5 seconds ? does any change in oscillator frequency affect the timers ability to sense time in seconds ?

please, suggest any online resources explaining internals of an MCU or microprocessor .

thanks in advance.
 

1. A clock is needed by the MCU to operate. That is to generate the instruction cycles and internal timming. Making possible the fetching of the instructions, accessing memory, etc. On the right times. The clock is derived from the osc. You may have the osc. working at 8 Mhz and the instruction cycle at 2 Mhz.
2 Most of the MCUs like the PIC series have an internal oscillator. And the only external component needed is a crystal, ceramic oscilator or RC circuit.
Others need a external oscilator to provide the clock to the chip.
Even on the MCUs that have an internal oscillator, an external osc. can be used to take advantage of a clock generated elseware on the board or for sync. purposes.
3. That is the max freq. that the MCU could operate. Most of the MCUs can operate from DC to this max. freq. Sometimes a little more but not for sure. You can also have a minimun operating freq. (specified on the datasheets)

4. Timers could be programmed to count pulses from different sources. For ejample the internal clock. If you know the freq. you can calculate the elapsed time by reading how much was the count, between the start and the stop of the timer.
That is you start the timer on the begging of the event you want to measure and stop it when finished. Then you read the count and calculate the time.

Hope that this very brief intro. helps.
For more info. you can read the datasheets of a MCU like the PIC16Fxx series.
 

1. Why do we need an oscillator in a Micro Conroller Unit (MCU) ?

Because MCU's are synchronous devices - everything happens in set steps, one after the other, controlled by the pulses of the oscillator.

2. Is there anything like internal and external oscillators ? what's the main differences in both and why do we need both ? why can't we use only internal one if there exists one ?

Yes. Some MCU's can generate in internal oscillator, some do not. But this is a fixed speed, is often not very precise (at best 1% of the stated value) and may drift a lot with temperature.

An external oscillator may be no better, or may be crystal controlled and much more precise and stable (0.01% typical). Also, you can use any speed you want within the MCU's parameters, slower or faster than an internal oscillator.

3. what do we mean by "4 MHz MCU", "8 MHz MCU", etc. ? Can we vary the clock speed (are clock speed and oscillator frequecy the same thing ?) of an MCU, if yes, then what's the minimum and maximum limit for that ?

MHz is the speed of the oscillator (millions of pulses per second). Yes it can be varied (see above) within the range allowed for the particular MCU.

The word 'clock' is often used as the same thing, but may not be. For instance, an old 8051 MCU takes 12 oscillator pulses for each internal 'clock' pulse. So, if you had a 12MHz oscillator, internally it would only do 1 million operations per second.

MCU's vary in this, some take only one oscillator cycle per internal operation, some 4, etc. depends on the MCU.

More modern versions of the 8051 for instance, have been redesigned to only need 4 (or even just 1) oscillator pulse for each internal clock pulse. Thus, they will operate faster (3x, or even 12x) on the same oscillator.

4. how the timers measure time difference between events, for example, how the timers know the time difference between two events is 5 seconds ? does any change in oscillator frequency affect the timers ability to sense time in seconds ?

The MCU does not understand seconds unless it has a real time clock (most don't). It just counts clock pulses. So, it is up to the programmer to know how many clock pulses correspond to 5 seconds or whatever. Yes, changing the oscillator speed willl change the number of clock pulses in a given time. So if a program needs accurate (real-time) timing, it must be run at the speed the program was written for.

please, suggest any online resources explaining internals of an MCU or microprocessor .

http://www.8052.com/

and here, of course. Remember to try the 'search' button above.

FoxyRick
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top