Author Topic: Control MCU frequency  (Read 596 times)

0 Members and 1 Guest are viewing this topic.

Offline greywanderer012345Topic starter

  • Full Member
  • ***
  • Posts: 109
  • Helpful? 1
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: 970
  • Helpful? 45
  • 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

  • Full Member
  • ***
  • Posts: 109
  • Helpful? 1
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!

 

Related Topics

  Subject / Started by Replies Last post
11 Replies
14588 Views
Last post October 02, 2009, 10:27:43 PM
by RoboGeek
3 Replies
1070 Views
Last post March 18, 2009, 11:18:30 PM
by SmAsH
1 Replies
1031 Views
Last post July 01, 2009, 11:26:18 AM
by adison
8 Replies
3761 Views
Last post March 17, 2011, 09:36:47 PM
by twinsratio


Get Your Ad Here