Shop OBEX P1 Docs P2 Docs Learn Events
Help in I2C Mike's driver. — Parallax Forums

Help in I2C Mike's driver.

BTXBTX Posts: 674
edited 2007-11-30 12:07 in Propeller 1
Hi all.
Since I can't solve my last problem, I'm planning to change the I2Cdriver object, for the "Mike Green Basic_I2C_Driver.spin" that is in the Object Exchange site.
I only need to save a byte, or word, or long in the demo board eeprom.

Does anybody uses it...or..... Mike...Could you give me an example, or "demo" about how it works ?
I'm trying to use it with my demo board....and never works for me.

Please any help would be apreciated.


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.

Alberto.

Envio editado por (BTX) : 11/29/2007 9:43:47 PM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-29 21:49
    Alberto,
    There's a brief example in the comments in the beginning. Can you give a sample of what doesn't work for you. I can't tell why you can't get it to work without more detail.
  • BTXBTX Posts: 674
    edited 2007-11-30 01:33
    Thanks so much for your help Mike !!

    Here's some code that I prepared to show "my programming error/s"

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Regards.

    Alberto.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-11-30 04:05
    1) You must wait after every write to EEPROM. The EEPROM is busy writing to its flash memory and will not respond for 5 to 10ms. You can either insert a pause of some kind (like: waitcnt(clkfreq/100+cnt)) or use the writeWait loop shown in the example. This will wait until the EEPROM begins to respond rather than waiting for a fixed amount of time.

    2) readByte, like readWord and readLong, is a function. Its value is the 1-byte, 2-byte, or 4-byte quantity read from the EEPROM.

    3) With the writePage and other multiple byte write routines, the EEPROM address cannot cross an EEPROM page boundary. For most 32K EEPROMs, these pages are 64 bytes. For some, it's 128 bytes. For larger EEPROMs, this page size can be as large as 256 bytes. If you assume a 64 byte page, you should be fine with any EEPROMs at least 32K in size.
  • BTXBTX Posts: 674
    edited 2007-11-30 12:07
    Thanks again Mike !!

    The code now is working.... I forget that write delay....sorry

    The "data format" to read·one byte, word, or long is:

    ByteVariable := ReadByte(i2c#BootPin, i2c#EEPROM, address)


    Now I'm going to insert the code into a real aplication.....I hope it will work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Regards.

    Alberto.
Sign In or Register to comment.