- Fri Dec 26, 2008 4:42 pm
#62084
Thanks for your tutorials (or lectures) on the AVR products. I've been fiddling with an ATMega8 and your guides and been having a fun time.
I have been using AVRDude as is installed by MacPack and it too has a blinking LED routine. That routine uses a function called _delay_ms() as opposed to your delay_ms(). That function is included from a file called util/delay.h .
I have tried both your delay function and the delay.h function and, interestingly, they are apparently 10 times different. For example, with the default 8MHz internal oscillator running on the Mega8, this:
I'm just curious and have two questions:
*Why is there a difference between the two functions? Which one is more accurate?
*Why are neither close to the half-second that they should be? Is it an oscillator issue? A fuse issue in setting up the Mega8?
Thanks for this wonderful playground.
\dmc
I have been using AVRDude as is installed by MacPack and it too has a blinking LED routine. That routine uses a function called _delay_ms() as opposed to your delay_ms(). That function is included from a file called util/delay.h .
I have tried both your delay function and the delay.h function and, interestingly, they are apparently 10 times different. For example, with the default 8MHz internal oscillator running on the Mega8, this:
Code: Select all
blinks just as fast as this:_delay_ms(5);
Code: Select all
Neither appear to be related to the half-second I would be expecting (it seems to be about one second on, one second off).delay_ms(50);
I'm just curious and have two questions:
*Why is there a difference between the two functions? Which one is more accurate?
*Why are neither close to the half-second that they should be? Is it an oscillator issue? A fuse issue in setting up the Mega8?
Thanks for this wonderful playground.
\dmc