First of all: Memory IC nomenclature is not robustly standardized; There is a lot of variation and even conflicting coding between manufacturers, on the order and meaning of the codes making up the part identifier.
That being said, here is an attempt at providing an overview:
The initial 2-digit code is the device family. A leading "24" indicates a I2C serially accessed EEPROM. Some other families are 95 (SPI serial EEPROM), Flash (e.g. 28F, 29F) and "standard" EEPROM (28).
Some manufacturers precede the 2 digits by a letter code, M for memory devices (STMicroelectronics, Atmel and others) optionally followed by an additional letter e.g. MX = Macronix memory.
Thus the device family becomes M24 for these examples.
The next letter or two usually indicates logic family / device voltage, but different manufacturers differ in their use of these codes:
- C = 5 Volts
- W = 2.7-3.6 Volts (sometimes 2.5 to 5.5 Volts)
- V = 3-3.6 Volts
- L = 4.5-5.5 Volts
- R = 1.8-5.5 Volts (typically STMicro)
- AA = 1.8-5.5 Volts (typically MicroChip)
- LC = 2.5-5.5 Volts
The digits after this do typically indicate memory capacity, but this is not simply the number of bits or bytes of memory. For instance, 512 = 512 Kilobits 8-bit EEPROM, but 516 = 512 Kilobits 16-bit EEPROM (usually, but not always!)
Some memory devices follow this up with a 2-digit access time code, i.e. access speed of the memory. Here again, 25 = 25 nanoseconds, but 10 = 100 nanoseconds usually.
This may be followed by a single or two-letter package indicator (B = Plastic DIP, N = TSOP, and a variety of other codes).
Last, a single-character (number or letter) device grade code may be added, i.e. various temperature ranges, military-grade, automobile grade, etc.
The only reliable way to interpret a particular memory IC's code, is to look it up in the datasheet, since there are wide variations, and even outright discrepancies, between manufacturers (and I suspect sometimes between production years too).
There are Application Notes for memory nomenclature by STM and several other manufacturers out there. Also, a fair guide to memory ICs, if somewhat incomplete, is here.
The device has 13 address pins, which should specify an address in binary from 0x0000 to 0x1FFF. You have not indicated that you are doing anything with them?
Also, I would suggest that you should write a writebyte
procedure which sets all address and data wires to output and puts proper values on them, ensures WE and OE are deasserted, asserts CE, asserts and release WE, and releases CE, and a readbyte
procedure which sets all address wires to output and puts proper values on them, sets all data wires to input, asserts CE and OE, samples all the data wires, and releases CE and OE. That will make the remainder of your code much more readable.
Best Answer
Here is how a read cycle is sequenced (extract from the datasheet you linked):
You see that, when the address changes, the DATA I/O lines are hatched. This means the output is unspecified. It could be anything, until tAA has elapsed. This timing is your EEPROM access time, and, depending on the part number, ranges from 150ns to 250ns. So, what you see is consistent with the spec.
Basically, the output are guaranteed to be correct only after this access time has elapsed. In the meantime, the address decoding may still be settling within the chip, and output may be inconsistent in this period. And, yes, results may be different for each chip.