EmbeddedRelated.com
Forums

How to Reset the AT24C01?

Started by Loamlo March 7, 2006
What is the quickest way to make the data in AT24C01 reset to 0xFF?
I write 0xFFto every byte, but that take a long time. Is there any
simpler method?

In the datasheet of AT24C01:
MEMORY RESET: After an interruption in protocol, power loss or system
reset, any 2-
wire part can be reset by following these steps:
1. Clock up to 9 cycles.
2. Look for SDA high in each cycle while SCL is high.
3. Create a start condition.

I write a program just like below, but it does not work. Is it wrong?
Thank you for you help!
Code List:

SCL		EQU		P3.1
SDA		EQU		P3.0

		ORG		00H
		AJMP	         START

		ORG		30H
START:
		MOV		B,#09H
CYCLE:
		CLR		SCL
		SETB 	SDA
		SETB 	SCL
		DJNZ	         B,CYCLE
		CLR		SDA

		AJMP	         START		
		END

That resets the I2C communications.  Erasing the part is another
matter, and I'm pretty sure since you can write individual bytes, you
must erase individual bytes.  This is opposed to larger parts or flash
that deal with sectors.

Loamlo wrote:

> What is the quickest way to make the data in AT24C01 reset to 0xFF? > I write 0xFFto every byte, but that take a long time. Is there any > simpler method?
If you really want to erase the entire memory, the only way is to write 0xFF. With this particular part, you can write 4 bytes in a burst to speed that up. A simpler, faster, method may be to not erase the memory at all, but leave the old contents in there, and rewriting your code to cope with that. Perhaps you could leave some marker that indicates which part of the memory is 'free'. Whether this is possible, and how, depends on the application. Alternatively, you could replace the part by a compatible device that allows higher erase speeds. E.g. the AT24C04 allows 8 byte bursts. Check out manufacturers datasheets.
Thank you very much for you help.
Now I know what's the matter.