I want to use 8 mhz crystal at place of 16mhz for arduino uno for low power application.
what changes i need to do in code .
Right now do not even i upload the code.
I think, you can use ATmega's internal oscillator 8MHz and it will be free of any HW changes, just different fuses. Next, you have to use different board like 'ATmega328 on a breadboard (8MHz internal clock)' - fuses are defined there so no problem. Finally, the last thing is to replace the bootloader and it is the hardest thing for newbies and must be done prior to upload any sketch. You need some kind of ISP programmer for bootloading, it could be another Arduino with the 'Arduino as ISP' sketch. This process is described here on web in 'Learning' or frequently recommended Nick Gammon's web as better guide for newbies. I thing, this is all you need.
What is the exact device in which you are thinking of changing the crystal?
If you are just using a standalone Atmega 328 you should be able to get it going with this tutorial.
...R
from amansri29
I want to use 8 mhz crystal at place of 16mhz for arduino uno for low power application.
...
How to make an Arduino-compatible minimal board
Atmega bootloader programmer
Solving problems with uploading programs to your Arduino (Fuse problems, uploading advice)
Budvar10:
@Robin2
I want to use 8 mhz crystal at place of 16mhz for arduino uno for low power application.
@Budvar - I had not realized it was your project? Why were you masquerading as @amansri29?
Let's give the OP time to answer - my question may not be entirely stupid. Changing the crystal on an Arduino board is unlikely to save much energy.
...R
How about just using the prescaler to halve the system clock? Can do it in software. No hardware change needed.
Yes, prescaler is an option. It was discussed short time ago here:
http://forum.arduino.cc/index.php?topic=374472.msg2582749#msg2582749
@Robin2
Sorry, I wanted just point to the fact. Editor sometimes drives me to crazy. Is it OK now?
Budvar10:
Yes, prescaler is an option. It was discussed short time ago here:
Slow down system clock - #7 by Budvar10 - Microcontrollers - Arduino Forum
Is it OK now?
Of course. I was just trying a humourous comment.
Still no response from the OP
...R
Using an internal clock is not a good option,as i am using serial communication and milis() function as very important role.
So i would like to replace external clock to 8 mhz simply.
I have replace the crystal oscillator and tried to program it with 8 mhz,its does work. So kind of changes i need to make to make it work.
Millis and serial will work with internal clock by the same way.
EDIT: Or use prescaler as was mentioned. HW invasion to the board can finish with its damaging but it is up to you. If you want to change the crystal, then just edit the board.txt and change the frequency and it will need the new bootloader for 8MHz.
amansri29:
Using an internal clock is not a good option,as i am using serial communication and milis() function as very important role.
I use Atmega 328s with the internal 8MHz oscillator without any problem with millis() or serial comms.
Are you talking about removing the 16MHz oscillator from an Arduino Uno board and replacing it with an 8MHz oscillator, or what, exactly, have you in mind?
...R