Shop OBEX P1 Docs P2 Docs Learn Events
WRITE problems — Parallax Forums

WRITE problems

Justin - FLCJustin - FLC Posts: 5
edited 2008-07-25 20:40 in BASIC Stamp
I have had problems with the write command.· I write to the eeproms and the numbers I get back do not correlate to the numbers I input.· Sometimes I get back 0, 513, (513 + 257), ... It seems as though there is a data type problem b/c of the addition of 257 to the previous index.· Do you notice any errors in my READ/WRITE coding?

Also, as the code sits it is too big.· Do you have any consolodation ideas?

Please let me know if the code did not get attached correctly.

Comments

  • Justin - FLCJustin - FLC Posts: 5
    edited 2008-07-25 20:35
    EXAMPLE


    The following Code returns the number 11051 when the number 555 was expected:

    i VAR Word
    x VAR Word

    Reset1 DATA 0
    Records DATA (700)
    RecordsEnd DATA

    FOR i = 0 TO 200
    WRITE i, Word 555
    DEBUG "k "
    NEXT

    FOR i = 0 TO 200
    READ i, Word x
    DEBUG DEC x, CR
    NEXT

    I am not sure when to use the DATA either.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-25 20:40
    Your problem is that you're writing 16-bit words consisting of two 8-bit bytes at byte addresses that overlap. Try "for i = 0 to 198 step 2"
Sign In or Register to comment.