Problem with saving to EEPROM...


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Tear's Avatar
    Tear Guest


    Did you find this post helpful? Yes | No

    Default

    Sorry for reposting the same thing. I read the manual and even though PICBasic makes it a lot easier for coding I am not strong at it at all. 99% of my experience as a student is in building circuits (just finished my sophmore year of EE).

    I have one question though, if you dont mind. Using DATA WORD 1500 works, but I am guessing that it places it at memory slot 0 of the EEPROM. How can I place another variable like this after the first one? I am sure that I need to includethe address in the command somehow.

    Thanks,
    Michael

  2. #2
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    762


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Tear
    I have one question though, if you dont mind. Using DATA WORD 1500 works, but I am guessing that it places it at memory slot 0 of the EEPROM. How can I place another variable like this after the first one? I am sure that I need to includethe address in the command somehow.
    OK,
    we are talking about the DATA statement.
    It preloads the EEPROM at program time.

    If you want to specify a location (other than the current pointer position) there is only one choice:
    use DATA @Location,Byte1,Byte0.......

    There is NO way of specifying a location (other than the current pointer position) a WORD is to be written to.

    But this is not much of a problem, since the WORD is written to the location starting from the current pointer position.
    (Bear in mind, a WORD is written LowByte first!)


    So:

    DATA @0,$11,$22
    DATA WORD $AABB
    DATA $33
    DATA $44
    DATA WORD $CCDD

    would result in the following EEPROM content:
    11 22 BB AA 33 44 DD CC

    Just try it !

    However,
    I would always use DATA with Bytes (since READ and WRITE only deal with Bytes), because later on in your program is a lot easier, you don't, have to remember wether or not you have to swap the order of the two bytes you have just "READ".
    regards

    Ralph

    _______________________________________________
    There are only 10 types of people:
    Those who understand binary, and those who don't ...
    _______________________________________________



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. 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
  4. EEPROM Read problem
    By Christos_K in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 5th June 2005, 17:10
  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