[Top][All Lists]

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

Re: [avr-gcc-list] Reading eeprom without using routines in eeprom.h, ca

From: Parthasaradhi Nayani
Subject: Re: [avr-gcc-list] Reading eeprom without using routines in eeprom.h, causes reset.
Date: Wed, 3 Oct 2007 23:21:30 -0700 (PDT)

I tested the code on mega8 using winavr release 20070525. No problems were encountered.


Michael <address@hidden> wrote:
Hi, when I was new to the avr-gcc (and still fairly new to C), I read the eeprom like this:
unsigned char eeread(unsigned char address)
            while(EECR & _BV(EEWE));
            EEAR = address;
            EECR |= _BV(EERE);
            return EEDR;
Not the ideal way of doing it, but it worked fine. I moved my code over from my debian system to winavr, which had a later version of the compiler.
The above code now causes the device to reset. I have experienced this on an Atmega128, and an Atmega8.
I can get things working again simply by using the eeprom.h routines in avr-libc, but I believe the above code should still work!
I currently have the latest version of winavr, I don’t remember which compiler version I was running under debian.
Can anybody shed any light on this? Why would the above code cause a reset when it used to work?
Regards, Michael.
AVR-GCC-list mailing list

Shape Yahoo! in your own image. Join our Network Research Panel today!
reply via email to

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