Using eeprom for the first time- Help please


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Your code:

    Code:
    write 200,"+" : write 201,"4" : write 202,"4" : write 203,"7" : write 204,"8" : write 205,"3" : write 206,"2" : write 207,"2" : write 208,"2" : write 209,"5" : write 210,"1" : write 211,"7" : write 212,"4" ' this is all in one line
    for c=200 to 212
    read c,my[c-200]
    next c
    You can write eeprom only once when you program your pic with this instruction at the begining of your program:

    Code:
    EEPROM 200,[43,52,52,55,56,51,50,50,50,53,49,55,52]
    
    'In your code when you need to load the number then
    
    for c=200 to 212
    read c,my[c-200]
    next c

    But you should avoid to use this peace of code (In red) otherwise you will erase your phone #

    Code:
    read 230,a : read 231,b : read 232,c
    if a<>"6" and b<>"8" and c<>"4"then
    for c=0 to 255
    write c,0
    next c
    ...........
    ...........

    You should use this instead, so you will save your number.

    Code:
    read 230,a : read 231,b : read 232,c
    if a<>"6" and b<>"8" and c<>"4"then
    for c=0 to 199
    write c,0
    next c
    ..........
    ..........

    In order to avoid holes in the eeprom you can change location to your phone # like this:

    Code:
    EEPROM 243,[43,52,52,55,56,51,50,50,50,53,49,55,52]
    
    'In your code when you need to load the number then
    
    for c=243 to 255
    read c,my[c-243]
    next c

    In this case you could erase up to location 242 and still save you phone #.

    Code:
    read 230,a : read 231,b : read 232,c
    if a<>"6" and b<>"8" and c<>"4"then
    for c=0 to 242
    write c,0
    next c
    ..........
    ..........
    Al.
    Last edited by aratti; - 11th October 2009 at 11:54.
    All progress began with an idea

  2. #2


    Did you find this post helpful? Yes | No

    Post

    Hi
    Thanks for the input.
    I wanted to fill the whole eeprom with "0" for the first time before loading any numbers to it, and choose 3 locations which are away from phone arrays and can mark if the code should enter there (first time) or not (anytime after the first time).

    I have managed to make it work. I am having problem with receiving string for my sms controller for which I have started another thread. Your input there will be appreciated.
    Thanks Again
    ___________________
    WHY things get boring when they work just fine?

Similar Threads

  1. Can't read sequential addresses in external EEPROM
    By tjkelly in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2010, 14:46
  2. Problem with I2C EEPROM addressing
    By Atom058 in forum General
    Replies: 14
    Last Post: - 3rd November 2009, 03:17
  3. Data EEPROM gets clobbered during programming
    By BrianT in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 18th July 2008, 02:46
  4. How to write/read strings EEPROM/LCD
    By g-hoot in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 11th February 2007, 06:26
  5. word variable to 25lc640
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 6th July 2004, 19:59

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts