Shop OBEX P1 Docs P2 Docs Learn Events
Quick question reguarding the eeprom write / read — Parallax Forums

Quick question reguarding the eeprom write / read

grasshoppergrasshopper Posts: 438
edited 2009-01-22 17:11 in Propeller 1
I noticed that the BS2 Object contains 3 types of write / reads. Could someone clarify the differences that each one offers.

Write(Addr,Value, size) 
        Write to EEPROM in code space, from top (32767) to bottom (0)
        where 0 = top of memory
                            
Write_HighMem(Addr,Value, size)
        Write to upper 32K of 64K EEPROM
        Write_HighMem(0,myVal,2) ' write byte variable myVal to upper 32K lowest address
                     
Write_CodeMem(Addr,Value, size)
        Write to direct code memory
        Useful in having a variable survive a reset




From what I see Write just starts storing data from the top. Is this so that one wont over write the stack?

The other 2 methods I am not clear on. Currently I am using the Write_HighMem and it seems to work. I just want to learn more.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-01-22 17:11
    It's fairly obvious if you look at the few lines of code involved. Write_HighMem just adds 32K to the address provided and Write just subtracts the address provided from $7FFF. Write_CodeMem doesn't change any of the parameters. If you're confused, strip out the comments for these routines from a copy of the BS2 object and you'll see how simple these routines are.

    The stack only exists in the hub ram, not in the EEPROM, so the area in the EEPROM beyond the end of the program is not really used although it's cleared to zero when a new program is downloaded (to the end of the 1st 32K if the EEPROM is larger than 32K).
Sign In or Register to comment.