It took a long time to write something.
Recently I am working on an IC card reader, which is not encrypted. It is actually an EEPROM. In fact, there is no technical content, as long as you have used EEPROM
.
Important: the IIC communication protocol is the basis of a single piece of learning and one of the required communication protocols. However, I found a very important thing.
Is the originalThe IIC protocol for 64 K or more EEPROM is different from that for small capacity!! Therefore, the Protocol must be modified. Another question is: How can I detect the capacity of an unknown EEPROM? This is indeed a problem I encountered during the development process. Today, we will not talk about complicated things. Simple.
Because I checked some materials during the development process and found that there are actually manyArticleI don't know how to use the EEPROM.
Therefore, I think it is necessary to enrich network resources.
Because the protocols above 64 K are a little different, we will not talk about large capacity today. Let's take a 2 k example.
Lazy a moment, with the way to explain, 2 k EEPROM has 256 addresses, each address can be used to store 8 bytes, A0-A2 does not need to use,2401 is 1 K,
It is supposed that only 128 addresses can be used, but the strange thing is that my at2401 can actually use 256 addresses, and the content of each address is not repeated. This is another strange thing I have found.. More than 2 k is required
You need to use the chip selection pin of the A0-A2 to read and write. We mainly talk about 2 K. In fact, as long as the addressing is increased from 0 to 1024, for example, from 0 to, it can be used and will not be repeated here.
The above is the address of the Site Selection header, 1010 is the IIC address of the EEPROM,
This is stipulated. If it is another IIC device, you need to use different headers. This is because IIC devices use two wires. If many devices are mounted on these two wires, how do you know that the device is to be selected now? This is why we set a very different header address edge number.
The above is the "write" Protocol process. As long as you understand this figure, you have mastered more than half of it, because your operations must follow these rules.Program.