I think something like that have to work
Now you just need to keep track of ControlByte and Address values.Code:<font color="#000000">Address <font color="#000080">VAR WORD </font>OldAddress <font color="#000080">VAR WORD </font>ControlByte <font color="#000080">VAR BYTE </font>Block0 <font color="#000080">CON </font>%10100000 Block1 <font color="#000080">CON </font>%10101000 Address=0 ControlByte = Block0 Start: <font color="#000080">I2CWRITE </font>SDA, SCL, ControlByte, Address, [0] <font color="#000080">PAUSE </font>10 OldAddress = Address Address = Address + 1 <font color="#000080">IF </font>Address<OldAddress <font color="#000080">THEN </font><font color="#008000">' Overflow? ' ---- YES </font><font color="#000080">IF </font>ControlByte=Block0 <font color="#000080">THEN </font><font color="#008000">' Are we in Block0? ' ---- YES </font>ControlByte=Block1 <font color="#008000">' Switch To Block1 </font>Address = 0 <font color="#008000">' Start at first address </font><font color="#000080">ELSE </font><font color="#008000">' ---- NO </font><font color="#000080">STOP </font><font color="#008000">' EEPROM is full.. </font><font color="#000080">ENDIF </font><font color="#008000">' </font><font color="#000080">ENDIF GOTO </font>Start
HTH
Last edited by mister_e; - 17th June 2007 at 21:29.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
johnmiller, (HINT), Use the page write mode as this will increase the available individual data points you can access. I currently use 2 of them for a total of over 2m bits in my TempTracker fishing accessory to log data at 1 second intervals with 2047 records of 128 bytes in page write mode. They work flawlesly. You might want to use page write mode instead of individual location reads and writes as this speeds up the transfer speed during write mode.
Dave Purola,
N8NTA
Thanks mister_e, that worked!
Dave, I tried to write data to the device using page write mode and it works first time, but when I write to it a second time it just overwrites some data. Here is how I write to it:
any thoughts on this one?Code:var SerData byte [80] I2CWRITE SDApin, SCLpin, ControlByte, i2cAddress, [str SerData\80] i2cAddress = i2cAddress + 80
I found the same problem here: http://www.picbasic.co.uk/forum/showthread.php?t=347 but nobody posted any response
Cheers
PS: I think I know why (after reading some on the internet) and now instead of [str SerData\80] I use 128 (since I read that it overwrites that page with the new contents).
Last edited by johnmiller; - 20th June 2007 at 03:28. Reason: Maybe that's why...
johnmiller, Yes it will overwrite the locations because it is only writing 80 bytes instead if 128 bytes before you are changing the address.....
Dave Purola,
N8NTA
Hello everyone,
I have the same problem with a 24lc1025, used as a data logger with a 16f876.
It writes and reads fine on the first block, but won't write anything on the second block.
Does anyone have any idea ?
Bookmarks