[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] _EEGET and _EEPUT
From: |
Brian Korsedal |
Subject: |
RE: [avr-gcc-list] _EEGET and _EEPUT |
Date: |
Mon, 15 Sep 2003 08:33:55 -0700 |
This code base was originally designed for IAR and then ported over to GCC.
I'd like to stick with _EEGET and _EEPUT as long as there are no big
problems. I think I figured out what I was doing wrong. I was passing
&serialAddress instead of serialAddress to _EEPUT. I'll try it in the
device and see what I get.
-----Original Message-----
From: E. Weddington [mailto:address@hidden
Sent: Mon 9/15/2003 8:25 AM
To: Brian Korsedal; address@hidden
Cc:
Subject: Re: [avr-gcc-list] _EEGET and _EEPUT
> 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.