Pages: [1]   Go Down
Author Topic: external memory  (Read 737 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

My application generates small arrays of integers.

I want to be able to store those for later use (after power down). I do not want to use
the memory on the arduino.

Can anyone recommend the easiest way to add a small memory chip (4k bytes? 16k bytes?)
so that I can, as needed, copy the current array to memory for later recall.

I have no idea if this is easy or hard so feel free to tell me if it is a hard problem.

Thanks in advance.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks like Yabb and Abba
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would have thought http://www.arduino.cc/en/Tutorial/SPIEEPROM  would be a fine solution?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think that may be just what I need - thanks!

For some reason it seemed like in my initial research I had ruled out out eeprom's but from the tutorial it looks like it would work great.

Where does the eeprom get the power to store the data? The types of devices I'm trying to copy usually have a battery that back's up the memory. What type of memory do you think that would be?

Thanks!

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I2C EEPROMs are also a possibility.
Eg. AT24C256 from Atmel (256 kbyte EEPROM)

There's not too much code on the Arduino website about I2C EEPROM interfacing, but I could write my own. Maybe I'll post it on the wiki soon. If anyone is having the same issues as me looking for I2C EEPROM code, here's an excerpt of my code:

Code:
byte i2c_eeprom_read_byte( int deviceaddress, unsigned int eeaddress ) {
  byte rdata = 0xFF;
  Wire.beginTransmission(deviceaddress);
  Wire.send((int)(eeaddress >> 8)); // MSB
  Wire.send((int)(eeaddress & 0xFF)); // LSB
  Wire.endTransmission();
  Wire.requestFrom(deviceaddress,1);
  if (Wire.available()) rdata = Wire.receive();
  return rdata;
}

void i2c_eeprom_write_byte( int deviceaddress, unsigned int eeaddress, byte data ) {
  int rdata = data;
  Wire.beginTransmission(deviceaddress);
  Wire.send((int)(eeaddress >> 8)); // MSB
  Wire.send((int)(eeaddress & 0xFF)); // LSB
  Wire.send(rdata);
  Wire.endTransmission();
}
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 106
Posts: 6371
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Where does the eeprom get the power to store the data?
EEPROM can store data without any power.  The ATmegas used in arduino have 512 bytes of internal eeprom (separate from the normal data memory or flash program memory) that will also retain data without power; it wasn't clear whether you understood this when you said you didn't want to use the internal memory for your data...

Quote
The types of devices I'm trying to copy usually have a battery that back's up the memory. What type of memory do you think that would be?
Like the CMOS configuration memory in desktop computers, eh?   Or sometimes piggybacked on some "clock" chips.   Compared to EEPROM memory, this sort of battery-backed low-power memory typically has fewer restrictions on how often or in what order you can write it.  For some time it was denser than EEPROM style memory, but  these days you can get SPI EEPROMs of about a megabyte for low prices.
Logged

Greenwood, Indiana
Offline Offline
God Member
*****
Karma: 0
Posts: 508
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm getting nowhere with an 24C01A I2C eeprom from Microchip. I'm just not conversant with how this works enough to guess why it doesn't.

Quote
I2C EEPROMs are also a possibility.
Eg. AT24C256 from Atmel (256 kbyte EEPROM)

There's not too much code on the Arduino website about I2C EEPROM interfacing, but I could write my own. Maybe I'll post it on the wiki soon. If anyone is having the same issues as me looking for I2C EEPROM code, here's an excerpt of my code:

Code:
byte i2c_eeprom_read_byte( int deviceaddress, unsigned int eeaddress ) {
  byte rdata = 0xFF;
  Wire.beginTransmission(deviceaddress);
  Wire.send((int)(eeaddress >> 8)); // MSB
  Wire.send((int)(eeaddress & 0xFF)); // LSB
  Wire.endTransmission();
  Wire.requestFrom(deviceaddress,1);
  if (Wire.available()) rdata = Wire.receive();
  return rdata;
}

void i2c_eeprom_write_byte( int deviceaddress, unsigned int eeaddress, byte data ) {
  int rdata = data;
  Wire.beginTransmission(deviceaddress);
  Wire.send((int)(eeaddress >> 8)); // MSB
  Wire.send((int)(eeaddress & 0xFF)); // LSB
  Wire.send(rdata);
  Wire.endTransmission();
}
Logged

If it was designed by man it can be repaired by man.

Pages: [1]   Go Up
Jump to: