At24LC512 memory size

As @anon73444976 said, the last valid address is 65535 (2^16 - 1). If you write to address 65536, I expect that will be equivalent to writing to address 0, writing to address 65537 equivalent to writing to address 1 and so on. That is because only 16 bits of address are available when communicating with the chip. Even though your code uses "long", these code lines

  Wire.write((long)(ceAddress >> 8));    //MSB
  Wire.write((long)(ceAddress & 0xFF));  //LSB

loose bits 16 to 31 of the long, they are not, and can not, be sent to the chip.

1 Like