About writing word variables into the eeprom


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    967


    Did you find this post helpful? Yes | No

    Default

    Ted, you're right on this. I goofed. But you got the idea though

  2. #2
    Ted's's Avatar
    Ted's Guest


    Did you find this post helpful? Yes | No

    Default

    Yes. But it does not seem to be efficient enough.

    A one or two-liner should be enough. Maybe using the remainder // ?

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    When you say efficient, do you mean speed or code size?
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    If you alias the Word array as a Byte array, you can just write 1 byte at a time in the loop.
    Code:
    arraysize  CON 20
    Array      VAR WORD[arraysize]
    
    @ByteArray = _Array
    ByteArray  VAR BYTE EXT
    
    FOR ArrayPosition = 0 TO (arraysize*2-1)
        WRITE ArrayPosition, ByteArray(ArrayPosition)
    NEXT ArrayPosition
    DT

  5. #5
    Ted's's Avatar
    Ted's Guest


    Did you find this post helpful? Yes | No

    Default

    When you say efficient, do you mean speed or code size?
    The latter.

  6. #6


    Did you find this post helpful? Yes | No

    Default

    I've only done this once a while back but all I did in my program at WRITE time is:

    WRITE 0,X.BYTE0 : WRITE 1,X.BYTE1

    At READ time:

    READ 0,X.BYTE0 : READ 1,X.BYTE1

    I don't remember having any problems. Hope it works.

  7. #7
    Ted's's Avatar
    Ted's Guest


    Did you find this post helpful? Yes | No

    Default

    It does.

    You know, the issue here is filling the eeprom with data from a word array. Your line is only a part of it.

  8. #8
    Ted's's Avatar
    Ted's Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    If you alias the Word array as a Byte array, you can just write 1 byte at a time in the loop.
    Code:
    arraysize  CON 20
    Array      VAR WORD[arraysize]
    
    @ByteArray = _Array
    ByteArray  VAR BYTE EXT
    
    FOR ArrayPosition = 0 TO (arraysize*2-1)
        WRITE ArrayPosition, ByteArray(ArrayPosition)
    NEXT ArrayPosition
    I do not understand your code. Please comment.

  9. #9
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    This should help some.
    Once you know what the EXT modifier does, it should make more sense.

    The EXT (external) modifier.
    http://www.picbasic.co.uk/forum/showthread.php?t=3891
    <br>
    DT

Similar Threads

  1. Read/Write Problem
    By Tobias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th February 2010, 01:51
  2. Minimizing code space
    By Tobias in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th May 2009, 07:25
  3. DS2760 Thermocouple Kit from Parallax in PicBasicPro
    By seanharmon in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th July 2008, 23:19
  4. calculation problem
    By nicolelawsc in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 31st March 2006, 15:23
  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