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
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to