

The 24LC256 is a 256 Kbit (32 K x 8) EEPROM (Electrically Erasable Programmable Read-Only Memory) manufactured by Microchip Technology. It communicates via the I2C (Inter-Integrated Circuit) interface, making it easy to integrate into microcontroller-based systems. This non-volatile memory retains data even when power is removed, making it ideal for applications requiring long-term data storage.








The following table outlines the key technical details of the 24LC256:
| Parameter | Value |
|---|---|
| Memory Size | 256 Kbit (32 K x 8) |
| Interface | I2C (2-wire) |
| Operating Voltage Range | 2.5V to 5.5V |
| Maximum Clock Frequency | 400 kHz (Fast Mode I2C) |
| Write Cycle Time | 5 ms (typical) |
| Data Retention | > 200 years |
| Endurance | 1,000,000 write/erase cycles |
| Operating Temperature Range | -40°C to +85°C |
| Package Options | PDIP, SOIC, TSSOP, DFN |
The 24LC256 is typically available in an 8-pin package. The pinout and descriptions are as follows:
| Pin Number | Pin Name | Description |
|---|---|---|
| 1 | A0 | Address input bit 0 (used for I2C slave address selection) |
| 2 | A1 | Address input bit 1 (used for I2C slave address selection) |
| 3 | A2 | Address input bit 2 (used for I2C slave address selection) |
| 4 | VSS | Ground (0V reference) |
| 5 | SDA | Serial Data (I2C bidirectional data line) |
| 6 | SCL | Serial Clock (I2C clock line) |
| 7 | WP | Write Protect (active HIGH; disables write operations when HIGH) |
| 8 | VCC | Power supply (2.5V to 5.5V) |
Below is an example of how to interface the 24LC256 with an Arduino UNO to write and read data.
#include <Wire.h> // Include the Wire library for I2C communication
#define EEPROM_I2C_ADDRESS 0x50 // Base I2C address of 24LC256
void setup() {
Wire.begin(); // Initialize I2C communication
Serial.begin(9600); // Initialize serial communication for debugging
// Write a byte to EEPROM
writeEEPROM(0x0000, 42); // Write the value 42 to address 0x0000
delay(10); // Wait for the write cycle to complete
// Read the byte back from EEPROM
uint8_t value = readEEPROM(0x0000);
Serial.print("Read value: ");
Serial.println(value); // Print the read value
}
void loop() {
// Nothing to do here
}
// Function to write a byte to the 24LC256
void writeEEPROM(uint16_t address, uint8_t data) {
Wire.beginTransmission(EEPROM_I2C_ADDRESS);
Wire.write((address >> 8) & 0xFF); // Send the high byte of the address
Wire.write(address & 0xFF); // Send the low byte of the address
Wire.write(data); // Send the data byte
Wire.endTransmission();
}
// Function to read a byte from the 24LC256
uint8_t readEEPROM(uint16_t address) {
Wire.beginTransmission(EEPROM_I2C_ADDRESS);
Wire.write((address >> 8) & 0xFF); // Send the high byte of the address
Wire.write(address & 0xFF); // Send the low byte of the address
Wire.endTransmission();
Wire.requestFrom(EEPROM_I2C_ADDRESS, 1); // Request 1 byte from EEPROM
while (Wire.available() == 0); // Wait for data to become available
return Wire.read(); // Read and return the data byte
}
No Communication with EEPROM:
Data Not Written to EEPROM:
Incorrect Data Read:
Q: Can I use the 24LC256 with a 3.3V microcontroller?
A: Yes, the 24LC256 operates within a voltage range of 2.5V to 5.5V, making it compatible with 3.3V systems.
Q: How many devices can I connect on the same I2C bus?
A: Up to 8 devices can be connected by configuring the A0, A1, and A2 pins to unique combinations.
Q: What happens if the power is lost during a write operation?
A: The data being written may be corrupted. It is recommended to use a power-fail detection circuit to prevent this scenario.
Q: Can I erase data on the 24LC256?
A: The 24LC256 does not have an explicit erase command. Writing new data to a memory location automatically overwrites the existing data.