Hi Guys, Thanks for the suggestions but I'm still not seeing the change in the clock. If I set the 9.6MHz fuse my circuit will use 5.1ma. If I change the fuse to the 4.8MHz choice my circuit will draw 3.6ma. No matter what I use for the CLKPR register values my program isn't changing the clock. I'm writing an 0x80 to the register and the next instruction is the CLKPR = 0x03 so it should be meeting the 4 cycle restriction as stated in the manual. Thanks, Richard Cooke -- In AVR-Chat@yahoogroups.com, "Larry Barello" <yahoo@...> wrote: > > I recently went through this exercise on the mega88. In short, it works > great, but I would check for any errata on the tiny13 regarding that option. > > My problem, it turned out, had nothing to do with the clock change, but in > recording whether I was running at high speed or not. My logic got out of > synch. I switch from CLK/2 to CLK/256 which has a dramatic effect on > current draw. > > Anyway, you need to make sure the two instructions follow each other. > Inspect the generated assembly code (assuming this is avr-gcc) to verify. > Another thing you can do is toggle an output pin and directly verify the > clock change. Depending upon your code, you might protect them with an > CLI/SEI pair. > > Finally, make sure that hooking up the dragon (in debug mode) that doesn't > mess up your expected current draw. I did all my measurements with the > one-wire debugger disabled. > > -----Original Message----- > From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf > Of Richard Cooke > Sent: Monday, November 20, 2006 9:23 PM > To: AVR-Chat@yahoogroups.com > Subject: [AVR-Chat] How do you change the clk speed? > > Hi Folks, > > I'm working on the ATtiny13 with the AVR Dragon and the latest version > of AVR Studio (4.12 SP4). I guess I don't understand how to change > the clock frequency correctly. I read the manual and I thought that > if I used: > > CLKPR=0x80; // enable the Clock Prescaler Change Enable bit > CLKPR=0x02; // system clock divide by 4 > > Isn't this the proper way to change the clock? I'm measuring the > current and I see no change. I'm running the chip at 5V and according > the the spec sheet I should measure a little over 1ma at 1.2MHz. > > Any ideas? > > Thanks, > > Richard Cooke > > > > > > Yahoo! Groups Links >
Message
Re: How do you change the clk speed?
2006-11-21 by Richard Cooke
Attachments
- No local attachments were found for this message.