--- In AVR-Chat@yahoogroups.com, David Kelly <dkelly@h...> wrote:
> I don't quite follow your problem. Does this answer your question?
>
> #include <avr/eeprom.h>
>
> typedef struct {
> int a,
> b,
> c;
> char s[32];
> } EEDATA;
>
> EEDATA eedata __attribute__ ((section (".eeprom")));
> EEDATA data;
>
> void
> main()
> {
> while(1) {
> data.a = 0;
> eeprom_read_block( &data, &eedata, sizeof(data) );
>
> data.a++;
> eeprom_write_block( &data, &eedata, sizeof(data) );
> }
> }
>
> --
> David Kelly N4HHE, dkelly@H...
>
=====================================================================
===
> Whom computers would destroy, they must first drive mad.
Yes, this does show it explicitly. I tried something similar, but
allocated individual variables instead of a structure because I will
nearly always be accessing them totally individually, only once in
the beginning as a block.
When I did this and initialized the eeprom variables, I got odd,
numbers looking like uninitialized data (in avr studio watch
screens). When I read and wrote them I still got numbers that were
not the uninitialized strange #'s. I will look at this more....
-TonyMessage
Re: need variables to be stored in EEPROM
2005-04-26 by arhodes19044
Attachments
- No local attachments were found for this message.