Shop OBEX P1 Docs P2 Docs Learn Events
Storing Data to EEPROMS — Parallax Forums

Storing Data to EEPROMS

TinkerTinker Posts: 12
edited 2005-01-02 14:13 in BASIC Stamp
Hapy New Year! I have a few questions about using I2C to store data to EEPROM. First, I'm having difficulty with the 2nd arguement of I2Cout, the SlaveID. Some examples I've seen set this 1-byte parameter as $A0 (chip address 000) and other examples change the chip address according to which block of data is being stored. In the case of the 24LC32A, for example, a block is 8K bytes. I thought that these chips had only one address. What gives here?
The other question regards what I would like to store in these EEPROMs. I want to take the 12-bit data fron an A/D, add one nib of sequence data, and store this word to the EEPROM. The problem seems to be that the EEPROM is geared to coded binary. For example, to store a word of binary takes only two bights. The designers of the EEPROMs would have us encode the same data into 5 ASCII bytes. I noted that the new version of PBasic allows Read/Write to work with Words. Is there a work-around for the I2Cout and I2Cin to allow the storage of data in Word format? If there is an app note re: this problem would appreciate where I can find it..Tnx......Tinker

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
.

Comments

  • TinkerTinker Posts: 12
    edited 2005-01-02 11:26
    It's 5 AM and I think I have realized the answer to my own question in the first part of my earlier post. Since we can use a maximum of 16 bits to address a byte in the EPROM, there are a max of 64K/2 words that can be addressed on a single chip. For the 24LC32A they have set this limit at 8K rather than 64K (they must use 2 bits for internal bookkeeping). So they invented the block system as a way of making "chips-within-a-chip". So maybe these "blocks" are to be regarded as separate chips. That would mean that the max addressable bytes under this scheme would then be 8X8K or 64Kbytes (32Kbyte words). Today EEPROMS exceed this number by a large factor so there must be different addressing schemes for MP3 players, PCMCIA cards, etc...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    .
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-01-02 14:13
    The I2C protocol is byte oriented. THAT said, it's very easy to store a Word variable using PBASIC modifiers:

    I2COUT SDA, slvAdrr, eeAddr, [noparse][[/noparse]value.LOWBYTE, value.HIGHBYTE]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
Sign In or Register to comment.