Shop OBEX P1 Docs P2 Docs Learn Events
BS2p vs 24LC128 — Parallax Forums

BS2p vs 24LC128

MaxfieldsMaxfields Posts: 1
edited 2006-10-08 17:33 in BASIC Stamp
Hallo, this is my first message!
I need save a variable from 0 to 360,·in 24LC128 eeprom by I2C line using BS2p24.
I use very short Parallax routine, but is possible store data until 255!!!

DO
DEBUG "Enter value to store from 0 to 255: "
DEBUGIN DEC3 Value
DEBUG CR, "Enter address to store ", DEC value, " at, 0 to 15999: "
DEBUGIN DEC5 eeprom_add
' Writing Section
I2COUT SDA, $A0,eeprom_add.HIGHBYTE\eeprom_add.LOWBYTE, [noparse][[/noparse]value]
PAUSE 20
' Reading Section
I2CIN SDA, $A1,eeprom_add.HIGHBYTE\eeprom_add.LOWBYTE, [noparse][[/noparse]value]
DEBUG CR, "Value stored at location ",DEC eeprom_add,
" is ", DEC value, CR, CR, CR
LOOP

In wich mode i can save value over 255?

Thank's,

Max.

·

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-08 17:33
    Hello,
    ·
    ·· Values larger than 255 must be a Word variable and stored into two bytes in the EEPROM.· Your routine would have to write the LOWBYTE and HIGHBYTE out separately as two bytes (writes).· The address pointer would need to be incremented by 2 each time.· I hope this helps.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.