[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] _EEGET and _EEPUT
From: |
E. Weddington |
Subject: |
Re: [avr-gcc-list] _EEGET and _EEPUT |
Date: |
Mon, 15 Sep 2003 15:25:54 GMT |
> I'm trying to save a variable to eeprom so that when I
turn the device off,
> it remembers the value of the variable. Every time I
start up the device, I
> call the line with _EEGET in it. Whenever the variable
changes, I call one
> of the lines with _EEPUT in it. The address is defined
on the first page.
> Does anyone see anything wrong with how I am implimenting
this. Does anyone
> know where I can find a good description of _EEPUT and
_EEGET?
>
> loadsave.h:#define EEOS_SERIAL_ADDRESS 0x0401
>
> main.c: _EEGET (serialAddress, EEOS_SERIAL_ADDRESS);
>
> mmi.c: if((choice==MI_SERIAL_ADDRESS)&&
((serialAddress &
> 0x0f)<0x0E)){serialAddress++;_EEPUT (EEOS_SERIAL_ADDRESS,
&serialAddress);}
>
> mmi.c: if((choice==MI_SERIAL_ADDRESS)&&
((serialAddress &
> 0x0f)>0x00)){serialAddress--;_EEPUT (EEOS_SERIAL_ADDRESS,
&serialAddress);}
>
> mmi.c: if((choice==MI_SERIAL_ADDRESS)&&
((serialAddress &
> 0x0f)<0x0E)){serialAddress++;_EEPUT (EEOS_SERIAL_ADDRESS,
&serialAddress);}
>
> mmi.c: if((choice==MI_SERIAL_ADDRESS)&&
((serialAddress &
> 0x0f)>0x00)){serialAddress--;_EEPUT (EEOS_SERIAL_ADDRESS,
&serialAddress);}
>
>
The two macros _EEPUT and _EEGET are defined strictly for
compatibility with the IAR compiler. These can be found in
<installdir>/avr/include/avr/eeprom.h.
If you do not need compatibility with IAR, I would suggest
you use the preferred avr-libc API:
eeprom_read_byte
eeprom_write_byte
See the avr-libc user manual for more information.
Eric
PS: Your first message came across
fine.