bug13:
I am not sure if I am at the right forums.Say if I write some code in Arduino IDE, and set the CPU_F to say 1MHz in the Arduino IDE, and upload the code to Arduino Mega 2560(or other arduino) with a programmer(wipe out the bootloader), will I still get the right time? eg delay and URAT com. etc...
My goal is to run the chip in just enough speed to save energy.
or if it won't work, what are the other option to run the clock slower.
Zhuhua
CPU_F does not control how fast the atmega runs it's a constant so that the compiler can make assumptions. You can mess with the fuse bits and/or change the crystal to do this and adjust CPU_F to match. There is a LOT of code that does not like speeds other than 16 and 8 mhz. Expect to have to program it via a ISP as the bootloader will not work correctly or be painfully slow. Any serial will need to be a low baud rate and general give you grief.
You can achieve a great deal of power savings from turning parts off that are not used and entering sleep modes.