storing multiple large arrays into EEPROM

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I want to store several large arrays into EEPROM. What is the line of code to do this?

All I can find is this:
eeprom_write_byte ((uint8_t*)<<location>>, <<byte to be written>>);

But that isn't conducive to easy storage of arrays . . .

And since we are on the subject, any simpler way to recall the array than this?
uint8_t <<byte read>> = eeprom_read_byte((uint8_t*)<<location>>);

Is it as simple as this?
eeprom unsigned int array[32]={48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48};

How do YOU make a robot?
http://www.societyofrobots.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This depends on what compiler you use. Tell us that and we can be more specific.

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you wanting to store them once initially, or at runtime, or a combination of the two?

If you have a compiler construction that lets you define eeprom data (such as the .eseg directive in assembly language), it will just produce a separate hex file that has to be burned to the eeprom using Studio or whatever. Everything will be in place when the application starts running.

Runtime updates call routines which write the eeprom memory, with its attendant overhead.

Now that I've stuck my neck out, someone will point out some compiler's startup code that actually does write into eeprom. If so, I'm all ears.

Chuck Baird

"I wish I were dumber so I could be more certain about my opinions. It looks fun." -- Scott Adams

http://www.cbaird.org

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Is it as simple as this?
eeprom unsigned int array[32]={48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48};

No it's as simple as:

unsigned int array[32] EEMEM ={48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48};

Then you use the eeprom_read_byte(&array[7]) that you already found.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

No it's as simple as:

ASSUMING you are using the infinite-value-brand compiler as implied by the mention of eeprom_write_byte. Other lower-value brand(s) might well use the OP's "simple" proposal.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I thought it was a fair assumption as eeprom_read_byte() had been mentioned - but maybe he just read that generally and not in the user manual for his compiler (which would always seem to be the best place to go looking for this kind of detail to my mind)

(of course real men don't read a manual until AFTER the smoke has escaped)