NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Increasing MCU Clock Speed

April 12, 2011
by CounterLogicEngineers
CounterLogicEngineers's Avatar

Is there a way to scale the clock speed for the ATmega 168 to 1/256 (or less? I was looking at the sample code/ register schematic and didn't see an obvious way of doing it. For a project, I need it to be able to sample at 200kHZ absolute min (ideally 250kHz+). Thanks for the help.

April 12, 2011
by Hexorg
Hexorg's Avatar

You can use timers for that. If you look at the ATmega's datasheet, it will tell you what registers to modify to have clock division (here's a good example: Making music with a microcontroller). Let me know if you need more in-depth help on how to use timers.

Stan.

April 12, 2011
by bretm
bretm's Avatar

Are you sure you want to slow it down? Even at full speed you'll have less than 60 clock cycles per sample at 250kHz sampling speed. It won't work it you slow it 1/256.

Post a Reply

Please log in to post a reply.

Did you know that interrupts can be used to trigger pieces of code when events happen? Learn more...