store a long number such as a phone number in eprom?

Im working on a project with a gsm modem at the moment and want to save the recipient phone number in the eprom so it can be changed without having to reprogram the arduino. Im stuck when it comes to storing the large phone number in the eprom. my guess is i have to split it into individual intergars and save them as bytes all in a loop sequence?... but im not sure how to split it up. does anyone have any other ideas? or any help to get me started will be great. thanks for reading .
luke

How are you storing the phone number in your sketch? Array of char?

Hi thanks for your quick reply. Yeah im storing as an array of char . So i only need to find out the length of the array and loop that amount + 1 to the memory location right?

Luke

right or check - Arduino Playground - EEPROMWriteAnything

So i only need to find out the length of the array and loop that amount + 1 to the memory location right?

It would certainly work better if you wrote each character to a different memory location.

Thanks for your replies , paul you have helped me out a few time cheers.

So my plan is to split into a char array and save each char into a new memory location.

As i want to send the data over the serial port ... example : $123456789* and so char n[] = 1 , 2 , 3 , 4 , 5......

i want to loop though the data coming in from the serial port and add each char into a new memory location the idea is to use a unique char to indicate the begining and end of the char array so i can use the serial port of other tasks etc not just this . So for this example "$" means start and "" end of the data . ($123456789)

Can someone help me get started adding the chars between "$" and "*" ?

thanks again

This code will collect the serial data between start and end markers into an array:

#define SOP '<'
#define EOP '>'

bool started = false;
bool ended = false;

char inData[80];
byte index;

void setup()
{
   Serial.begin(57600);
   // Other stuff...
}

void loop()
{
  // Read all serial data available, as fast as possible
  while(Serial.available() > 0)
  {
    char inChar = Serial.read();
    if(inChar == SOP)
    {
       index = 0;
       inData[index] = '\0';
       started = true;
       ended = false;
    }
    else if(inChar == EOP)
    {
       ended = true;
       break;
    }
    else
    {
      if(index < 79)
      {
        inData[index] = inChar;
        index++;
        inData[index] = '\0';
      }
    }
  }

  // We are here either because all pending serial
  // data has been read OR because an end of
  // packet marker arrived. Which is it?
  if(started && ended)
  {
    // The end of packet marker arrived. Process the packet

    // Reset for the next packet
    started = false;
    ended = false;
    index = 0;
    inData[index] = '\0';
  }
}

Currently the start and end markers are < and >, but you can change them to anything you like.

just a thought:

note that you can store 2 digits of a phone number in one byte of EEPROM. Minimizes storage and (almost)doubles the speed of store/retrieve

Sorry for the late reply , Paul that was exactly what i was after . For anyone whos intrested i got it working by just looping though the inData array in pauls code and then doing an eprom write with the address + 1 each time. All this was inserted into the "if(started && ended) " section.

spot on paul !

Thanks for everyones help and advice.

Luke

You could post your final code here for future reference!
and yes , PaulS is good and sharp!

So is he going to go for BCD and get twice as much in his EEPROM space or not?

Luke, BCD is Binary Coded Decimal and stores digits 0-9 in 4 bits each, so you get 2 digits per byte.