Go Down

Topic: "blink" on Atmega8 works perfectly but time slowed down! (Read 2 times) previous topic - next topic

giantsfan3

Setup:
I'm using Arduino as ISP to burn small programs onto an external Atmega 8L chip on a breadboard, with a 4 MHz crystal (don't have an 8 MHz lying around), and an LED on one of the digital pins.

For example, right now, I burned the Blink program (with 1000 msec interval between pin HIGH and LOW in the code).

Problem:
Everything works fine, BUT the blinking happens every 3-4 seconds instead of the coded 1 second.
(Similar things happened with Fade program, etc.; everything works but seems to slow down a few-fold)

Wondering why this might be..

Graynomad

Quote
Wondering why this might be..


Quote
4 MHz crystal (don't have an 8 MHz


Ummm, let me think about that for a while :)

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Simpson_Jr

You've fooled the microcontroller, it now counts 3600 secs in 2 hours, but otherwise functions fine.
Likewise it will probably see 3600 secs in 30 minutes time using a 16MHz one.



giantsfan3

hehe shoot, such an obvious reason huh?

but hmm wondering why the LED is not blinking exactly HALF the speed (it's blinking around quarter or less the speed) if I'm using a 4 mhz. maybe it has do with the fact that the frequency dictates the number of instructions executed per second, to which the LED blinking might not be linearly proportional because of the presence of other operations in the code. just ordered some 8 mhz crystals; will do some timing tests soon.

Coding Badly

Did you change the fuses to use an external crystal?

Go Up