EEPROM (24lc256) --> arduino

here’s my problem. i want to expand my uno’s memory. i bought the eeprom i wrote above but i dont know how to use it. in fact, i found the following code but i dont want exactly to do that thing. this code writes “123” and reads it from eeprom. what i want to do is to save the whole programme i wrote to the eeprom and not just the “123” as i said before and then run it from the eeprom.

#include <Wire.h>

#define disk1 0x50 //Address of 24LC256 eeprom chip

void setup(void)
{
Serial.begin(9600);
Wire.begin();

unsigned int address = 0;

writeEEPROM(disk1, address, 123);
Serial.print(readEEPROM(disk1, address), DEC);
}

void loop(){}

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

delay(5);
}

byte readEEPROM(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;
}

Check this library - http://playground.arduino.cc/Main/LibraryForI2CEEPROM - (latest version on github)

johnpadelios1: here's my problem. i want to expand my uno's memory. i bought the eeprom i wrote above but i dont know how to use it. in fact, i found the following code but i dont want exactly to do that thing. this code writes "123" and reads it from eeprom. what i want to do is to save the whole programme i wrote to the eeprom and not just the "123" as i said before and then run it from the eeprom.

I am not aware of a way to extend the compiled program code from flash into external eeprom. External eeprom is generally used for data which can be read into SRAM for tables, conversions factors, lookup as well as writing logging data.

For an interpreter, such as Bitlash, program statements could be in the external eeprom.

A crafty programmer may be able to devise a boot loader that would be able to read the external eeprom and move segments into the user flash space, but I have not seen such overlay technology used in microprocessor technology.

Ray

MrBurnette did read more carefully than I did :)

If you want run code from EEPROM one option is to have an interpreter in FLASH (UNO) and read instructions from the EEPROM. check - http://bitlash.net/ - but be aware of the limitations.

If you want to execute native AVR assembly code I can only think of developing an "Arduino virtual machine" which will be far from trivial and I doubt if it would fit in an UNO's memory.

i solve this problem but i have another one now. i take values from a sensor,i save them in my ssd card and know i want to put them online. what i want to do is to send the last value on a php url and i dont know how to do this. does anyone of you have an idea?

thank u all for your help.!!

if you dont understant , i want to do that: i have an url , for example www.something.gr/something.php=X . X is a variable . i want this X to take tha last value of the sensor and put it on the url and save it.

p.s. if i put for example 5 instead of X (thats what i want to do) and open the url , 5 will be as a comment inside the page