Shop OBEX P1 Docs P2 Docs Learn Events
EEPROM WriteWait — Parallax Forums

EEPROM WriteWait

william chanwilliam chan Posts: 1,326
edited 2008-12-12 23:47 in Propeller 1
Hey Mike,

Why does the WriteWait method in Basic_I2C_Driver require 3 input parameters?
I think it should be simplified to 2 input parameters.

I tried using eeprom.WriteWait(eeprom#bootpin,eeprom#eeprom,loc) where loc is the location of the last WriteLong, but it seems to be unstable.
Should use zero instead for the 3rd parameter?
Replacing the WriteWait with waitcnt(clkfreq/40 + cnt) solves the stability problem.

But i was hoping to use WriteWait to minimize the total writing time of a large array. (1024 longs)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-12 14:22
    The WriteWait statement has 3 parameters like other EEPROM functions:

    1) The pin # of the I2C bus to be used (CLK pin # with DTA pin # the next highest)

    2) The device select code for the EEPROM. This includes a device number (0-7)

    3) An EEPROM address with blocks of 64K using separate select codes. Note that the bits representing the block # are combined with the device select code's device number so you can use either to select a memory.

    The 3 parameters were used to make the different calls (READ / WRITE / WAIT) look and act similarly.

    As usual for any sort of problem, it's important to give schematics, program source, and enough of a description so others can understand what's happening. WriteWait uses a feature of all current EEPROMs, that the EEPROM will stop responding during a write cycle until the cycle is finished. WriteWait simply attempts to start a read operation by selecting the device, then a memory location, but quitting before the read is actually done.
  • william chanwilliam chan Posts: 1,326
    edited 2008-12-12 23:42
    Is it necessary to call WriteWait in a loop until it's return value is zero?

    I think that could be my problem......

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.fd.com.my
    www.mercedes.com.my
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-12 23:47
    Yes, look at the example in the comments at the beginning of the object source. It provides for a timeout in case there's an error.
Sign In or Register to comment.