Pages: [1]   Go Down
Author Topic: how to read/retrieve eeprom's content  (Read 2912 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am new to this. I am sorry if I am posting this at the wrong place. I have a Arduino Uno. I like to read the eeprom and have its content sent back to my computer.  I found the code (see below) but I don't know how to use/execute it. What software/program do I use ? What are the exact steps to do this (hardware connection and software execution) ? I am using a USB cable between my computer and the Arduino Uno, and using the downloaded Arduino software (arduino-0022.zip) on Windows XP.  Any help would be greatly appreciated.

/*
 * EEPROM Read
 *
 * Reads the value of each byte of the EEPROM and prints it
 * to the computer.
 * This example code is in the public domain.
 */

#include <EEPROM.h>

// start reading from the first byte (address 0) of the EEPROM
int address = 0;
byte value;

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

void loop()
{
  // read a byte from the current address of the EEPROM
  value = EEPROM.read(address);
 
  Serial.print(address);
  Serial.print("\t");
  Serial.print(value, DEC);
  Serial.println();
 
  // advance to the next address of the EEPROM
  address = address + 1;
 
  // there are only 512 bytes of EEPROM, from 0 to 511, so if we're
  // on address 512, wrap around to address 0
  if (address == 512)
    address = 0;
   
  delay(500);
}
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am new to this. I am sorry if I am posting this at the wrong place. I have a Arduino Uno. I like to read the eeprom and have its content sent back to my computer.  I found the code (see below) but I don't know how to use/execute it. What software/program do I use ? What are the exact steps to do this (hardware connection and software execution) ? I am using a USB cable between my computer and the Arduino Uno, and using the downloaded Arduino software (arduino-0022.zip) on Windows XP.  Any help would be greatly appreciated.

Well the easiest way to watch that sketch do it thing is just to upload the sketch to your board. Then there is a serial monitor button on the IDE that you can use to watch any serial data that the board is sending. You do have to select the correct baudrate value for the serial monitor, 9600 is being used in our example sketch. One can also send serial data to the arduino board using the serial monitor, but the sketch has to have the correct programming steps to read the data.

Does that get you started?


PS: I went ahead and uploaded that sketch into my arduino and it does indeed work fine and the serial monitor shows the values of the eeprom being read.
« Last Edit: February 26, 2011, 09:49:28 pm by retrolefty » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the quick response, and the information.  It's working, I am watching two columns of data on the Serial Monitor now, it shows
1   105
2    255
(some output lines omitted)
511 255

then the process started all over again.  I don't know what that means, I was expecting something different since I thought the bootloader is in eeprom, maybe I am wrong. I'll study that part.

By the way, along the same line, I have another question if I may: how to read/retrieve other code from the board ? e.g. I uploaded the code for a night light (light sensor+LED) project, any way to retrieve that code ? Assuming there is a way to retrieve it, I would think the retrieved data would be in some type of binary or hex format instead of the original C format, correct ?

Sorry for long message.
Thanks again.
 
 
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 495
Posts: 19040
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The EEPROM is different memory from the RAM and that is different from the PROGMEM (program memory). Program memory is where the bootloader is.

You could conceivably extract out the binary code from the device, but there is no practical way to turn it back into a C sketch. The only real purpose of attempting to extract the code would be if you wanted the exact same program to run on another Arduino, but never have any (practical) chance to modify it.
Logged


Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
how to read/retrieve other code from the board ? e.g. I uploaded the code for a night light (light sensor+LED) project, any way to retrieve that code


After you upload a sketch into the board and then close out the arduino IDE it asks you if you want to save the sketch. Normally you would say yes and there will be a folder created for your sketch so that later you may upload it again, or modify it, etc.

Your Arduino board and the Arduino IDE running on your PC form a system for development. The PC is used to save sketches and library routines and other aids to programming your board. The board just runs whatever sketch was last loaded. It has non-volatile flash memory so even if you power off the board the next time you power it up it will run the last program loaded into it. It's a simple and sweet platform that is easy to learn yet effective enough to keep you learning for a long time to come.

Lefty
Logged

Pages: [1]   Go Up
Jump to: