> Compiling with WinAVR
> ATMega8
> External clock (8Mhz crystal)
> My Fuses are set correctly
>
> -------------------------------
>
> I've modified the makefile to have:
>
> F_CPU = 8000000
>
>
>
> -------------------------------
> C Source:
>
>
> #include <avr\io.h>
> #include <avr\delay.h>
>
> int main(void)
> {
>
> //set port c as all output
> DDRC = 0xff;
>
> PORTC = 0x20;
>
> _delay_ms(37);
>
> PORTC |= 0x10;
>
>
> }
>
It works in AVR Studio with different delay times giving the correct
timing. I also simulated it in Proteus, which agreed. What have you
set the optimisation level to in the project options? Level -O0
causes timing errors (and produces a warning when you compile).
Richard---------------------
Vacuum Cleaners-
...helpful household appliances or electronic carpet parasites set to
take over the World?
Make up your own mind -but get it right first time, your planet
depends on you!Message
Re: [AVR-Chat] Delay issue
2008-09-05 by Richard Reeves
Attachments
- No local attachments were found for this message.