Author Topic: Control MCU frequency  (Read 1894 times)

0 Members and 1 Guest are viewing this topic.

Offline greywanderer012345Topic starter

  • Robot Overlord
  • ****
  • Posts: 133
  • Helpful? 2
Control MCU frequency
« on: August 16, 2012, 12:53:31 AM »
I'm using an atmega328p and AVRStudio4. The MCU is supposed to be 8MHz, but it processes as if it is running at 1MHz, eg. the _delay_ms() function works correctly when F_CPU is defined as 1000000UL. Do I have some fuses set to slow it down or something? I had the $50 robot halfway built over a year ago, but had to get out of it for a while. I got the time to get back into robotics about a month ago. This is one of the things that has been bothering me. I halfway remember there being a way to slow the processor to save battery. Am I mistaken? Thanks for any help.

Offline newInRobotics

  • Supreme Robot
  • *****
  • Posts: 1,015
  • Helpful? 48
  • N.I.R.
Re: Control MCU frequency
« Reply #1 on: August 16, 2012, 02:43:09 AM »
As far as I know ATmega328P by default has CKDIV8 fuse on. If You clear it, uC will run @ 8MHz. Don't forget to change F_CPU to 8000000UL to get all timings correct. Don't touch any other fuses if You don't know what they do.

"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian W

Offline greywanderer012345Topic starter

  • Robot Overlord
  • ****
  • Posts: 133
  • Helpful? 2
Re: Control MCU frequency
« Reply #2 on: August 16, 2012, 05:33:34 PM »
Thank you. That has to be the fastest, most thorough answer I've received. I knew it had to be something simple, but I was loath to start playing with the fuses. Thanks again!

 


Get Your Ad Here

data_list