I am the first time user for atmega328P microcontroller and I'd like to ask your input about its clock. I read its datasheet and documentation and I saw some clock name as follow:
CPU clock (CLKcpu)
I/O clock (CLKi/o)
Asynchronous clock (CLKasy)
My question is:
do above clock run at the same frequency or different frequency.
can i use them independently each other and changing their frequency. if yes, how can i configure each clock with different frequency.
thanks for your input. you mean at arduino level I can't use these clocks. what's about if it stands alone (by itself microcontroller), then I can use them?
you mean at arduino level I can't use these clocks. what's about if it stands alone (by itself microcontroller), then I can use them?
No
They are used at the Arduino level and your attempt to "use" them for direct manipulation is at the expense of issues with Arduino commands; so if you manually change a clock, you could "break" the compiled code. But, they can be manipulated. But, there should be no particular reason to do so outside the use of standard Arduino commands. If you are writing assembler, you are not using standard Arduino.
Arduino is hardware and software that is intended to hide most information on low-level microcontroller architecture.
If you are new to Arduino programming stick to the standard stuff until you actually have a situation in which it isn't sufficient. I suspect that will take some time.
...R
P.S. It usually takes me 10 or 15 reads to make sense of parts of the datasheet.
do above clock run at the same frequency or different frequency.
can i use them independently each other and changing their frequency. if yes, how can i configure each clock with different frequency.
As far as I can tell, CLKi/o is derived from the same place as CLKcpu, so they are not configurable to run at independent rates. The main feature of CLKi/o is that it remains on, even when the CLKcpu is turned off to implement various power-saving modes.
CLKasy is entirely separate and you can change its frequency by providing a different frequency clock signal to the appropriate input pin or oscillator.
In general, if you are interesting in doing things at different frequencies, these are NOT the clock options you should be looking at. Instead, you need to look at which features share which clocks, particularly among the timers (timers are your basic microcontroller timing-generator things.) For instance, there are three timers, but two of them share a prescaler (sort-of) that is different than the prescaler of the third timer. Each timer has 2 "output capture units" (which implement PWM), so you have six PWM outputs, but only three possible simultaneous PWM frequencies...