avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Strange delay behavior


From: Per-Tore Aasestrand
Subject: [avr-gcc-list] Strange delay behavior
Date: Sat, 09 Jun 2007 18:05:56 -0000

Hello list,

I've suddenly run into something odd. I am using AVR Studio Version 4.12 Service Pack 4 with WinAVR 20060421. Have been using this setup for a while without any problems.

Now, running the following test program on a ATmega128 @ 8 MHz, produces pulses on PC3. However, with 'off' period of 1,45 ms and 'on' period of 2,45 ms and. I had of course expected 1ms and 2 ms, respectively.

I ran the same program using CodeVision, and then the periods were OK.

Guess I've overlooked something.
Any idea, someone?

Regards,

Per-Tore

#define F_CPU 8000000UL

#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
        // Initialize I/O Ports
        DDRC  = 0x08;                     // PC3: output

        for(;;)
        {
                 PORTC = 0x00;
                 _delay_ms(1);
                 PORTC = 0x08;
                 _delay_ms(2);
        }
}

              \\|//
             /_"""_\
            |(O) (O)|
 --------oOOO--(_)--OOOo---------
|                                |
|   Per-Tore Aasestrand          |
|   E-mail: address@hidden        |
|   Tel   : +47 55 32 32 35      |
|   Mobile: +47 920 444 76       |
|   PO Box 1708 Nordnes          |
|   N-5816 BERGEN                |
|   Norway                       |
|                                |
 --------------------------------

Only recycled bits have been
used in this email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]