AT24C256 EEPROM Library for Proteus Simulation: the EEPROM module and an Arduino UNO V4.0

AT24C256 EEPROM Library for Proteus Simulation

40
700
60
25
60
PCBWay

Hello friends, I hope you all are doing great. Today, I am going to share the new AT24C256 EEPROM Library for Proteus Simulation. The 24C256 is the little eight-pin memory that remembers things when the power is gone: settings, calibration values, a counter, a log of readings. On a small blue module with an I2C header it is one of the first parts people add to an Arduino project that has to remember anything. With this library you can run a Proteus simulation of that module and see exactly how such a memory is written and read - page by page, byte by byte - and the memory even survives the end of the simulation, the way a real EEPROM survives a power cut.

AT24C256 EEPROM Proteus simulation: an Arduino UNO V4.0 writing a boot counter, a message and a data log
Figure: The AT24C256 EEPROM simulation running: the Arduino writes and reads the memory over I2C.
Updates

AT24C256 EEPROM Library for Proteus

Latest version: V1.0 (December 2026, this tutorial)

Helping Tools

The demo is a small data logger: the Arduino counts its own boots, stores a message, falls into the famous page trap on purpose and climbs out again, and fills four pages with a log.

NOTICE: Our team has put a lot of effort into these small parts: the bodies, the animation and the pop-ups are all our own design, and you get them free. Your feedback is the fuel that keeps us going, so please tell us what you think in the comments below or in the LCD board of our forum. And if our free libraries help you, you can buy us a coffee. So, let's get started with the AT24C256 EEPROM Library for Proteus Simulation:

AT24C256 EEPROM Library for Proteus Simulation: the EEPROM module and an Arduino UNO V4.0
Figure: The AT24C256 EEPROM Library for Proteus Simulation.

What Is the AT24C256 EEPROM?

An electrically erasable programmable read-only memory with an I2C interface. Despite the old name it is not read-only at all: every byte can be rewritten about a million times, and it keeps its contents for decades without power. The 24C256 holds 256 kilobits - 32,768 bytes - arranged in 512 pages of 64 bytes. It needs only two signal wires, SDA and SCL, and it works from 1.7 V to 5.5 V, so it sits happily next to a 5 V UNO or a 3.3 V ESP32.

The AT24C256 at a glance
AT24C256
Size32,768 bytes (256 kbit)
Organisation512 pages of 64 bytes
InterfaceI2C, 0x50 - 0x57 (A2 A1 A0)
Word address2 bytes, the high byte first
Write cycle5 ms at most per page
Enduranceabout 1,000,000 writes per byte
Pins (module)VCC GND SDA SCL

The address on the bus is 1010 followed by the three address pins A2, A1 and A0. On the module these are jumpers, so up to eight memories can share one bus at 0x50 to 0x57 - a quarter of a megabyte on two wires. A fourth jumper, WP, protects the whole memory against writing.

How a Write Works

The Arduino sends the chip's address, then two bytes for the word address inside the memory - the high byte first - and then the data. The data do not go into the memory cells directly: they fill a 64-byte page buffer. When the Arduino sends the STOP, the chip starts the real write, the internal write cycle, and copies the buffer into the page. That takes up to 5 ms, and during that time the chip is deaf: it does not even acknowledge its own address.

ACK Polling

A sketch could simply wait 5 ms after every write, but there is a smarter way that the datasheet itself recommends. The sketch sends an empty write - just the address - over and over. As long as the chip is busy, the address byte gets a NACK; the first ACK means the write cycle is over and the chip is ready. This is ACK polling, and it means the sketch waits exactly as long as the chip needs and not a microsecond more. The library models the write cycle and the NACKs, and the pop-up counts every poll.

The Page Trap

Here is the detail that catches almost everyone once. Inside the page buffer the address counts only within the page. If a write starts at 0x00F8 - eight bytes before the end of the page at 0x00FF - and carries ten bytes, the first eight land where expected, and the last two do not go on to 0x0100. They roll over to the start of the same page, 0x00C0, and overwrite whatever was there. Nothing warns the sketch; the data are simply in the wrong place. The cure is to split long writes at the 64-byte page boundaries. The simulation does the roll-over exactly like the chip - and, unlike the chip, it writes a warning into the event log.

How a Read Works

Reading is simpler and has no page limit. The chip keeps an address counter. A current address read just asks for bytes and gets them from the counter onwards. A random read first writes the two address bytes without any data - a "dummy write" that only sets the counter - then sends a repeated START and reads. A sequential read simply keeps reading: the counter runs through all pages and wraps from 0x7FFF back to 0x0000.

A Memory That Survives the Simulation

A real EEPROM keeps its contents when the power goes off, and so does this one. With the INIT property at KEEP, the model stores the memory after every write cycle and loads it again at the next run. Stop the simulation, start it again, and the sketch finds what it wrote last time - which is exactly what an EEPROM is for. Set INIT to ERASED and every run starts with a new chip, full of 0xFF.

Features of the AT24C256 EEPROM Library for Proteus Simulation

  • A real-looking module: the 36 x 22 mm board at its real size, the 24C256 in its socket, the address and WP jumpers (they follow the properties) and the PWR LED.
  • The real protocol: the 2-byte word address, page writes into the 64-byte buffer with the roll-over, current, random and sequential reads.
  • The write cycle: 5 ms with no answer - ACK polling works, and the pop-up counts the polls.
  • Non-volatile: INIT KEEP keeps the memory between runs.
  • WP: a property, and a jumper you can click at Run.
  • A pop-up: a map of all 512 pages, a hex view with ASCII that follows the writes, eight tiles - graphs, an event log and a check page.
  • A complete package: about 1.3 MB with the library, our Arduino UNO V4.0 and the demo, without the source code of the model.

The AT24C256 in Proteus

The device is EEPROM24C256TEP in TEPAT24C256.LIB, under Modules > Memory, with the prefix U and the model TEPAT24C256.DLL. Search 24C256 or EEPROM in Pick Devices. The header on the left has VCC, GND, SDA and SCL. Three properties: ADDRESS (0 to 7 for 0x50 to 0x57), WP (OFF or ON) and INIT (KEEP or ERASED).

AT24C256 EEPROM module from the AT24C256 Library for Proteus Simulation
Figure: The AT24C256 module.

Download AT24C256 EEPROM Library for Proteus Simulation

Click the button below to download AT24C256-EEPROM-Library-for-Proteus-v1.0.zip (about 1.3 MB, without the source code of the models):

AT24C256 EEPROM Library for Proteus V1.0
  • README.txt: installation, the demo, the wiring, troubleshooting and the limits of the simulation.
  • Proteus Library Files: TEPAT24C256.LIB and ArduinoV4TEP.LIB.
  • Proteus Model Files: TEPAT24C256.DLL and TEPARDUINO.DLL.
  • Arduino Code: the demo sketch (Wire only).
  • Proteus Simulation: the demo project, its HEX file and copies of the DLLs.

No Proteus yet? Read How to Download and Install Proteus 7 and 8. New to libraries? Follow How to Install a New Library in Proteus.

How to Install AT24C256 EEPROM Library for Proteus Simulation

  1. Close Proteus and extract the whole zip file, for example to your Desktop.
  2. Copy the files from Proteus Library Files into the LIBRARY folder of Proteus.
  3. Copy the files from Proteus Model Files into the MODELS folder.
  4. Delete TEPAT24C256.IDX from the LIBRARY folder if it is there.
  5. Start Proteus, press P and search for 24C256.

Proteus Simulation of an EEPROM Data Logger

The demo uses an A4 sheet with our Arduino UNO Library for Proteus V4.0 and the EEPROM module U1: SDA on A4, SCL on A5, VCC on +5V. ADDRESS is 0, so the chip answers at 0x50; WP is OFF and INIT is KEEP. The UNO's own L LED lights while a page is being written. The Arduino's monitor is built in, the same window as our TEP Serial Monitor Advance for Proteus. Open AT24C256-EEPROM-Logger-ArduinoUnoV4.pdsprj.

AT24C256 simulation in Proteus: the EEPROM module on the I2C bus of an Arduino UNO V4.0 on an A4 sheet
Figure: The whole simulation on an A4 sheet.

The Sketch

The sketch needs only the Wire library. Three small functions do all the work. The first waits for the write cycle by ACK polling and counts the NACKs:

uint16_t eeWait() {
  uint16_t polls = 0;
  for (;;) {
    Wire.beginTransmission(EE);
    if (Wire.endTransmission() == 0) return polls;
    polls++;
  }
}

The second writes any amount of data safely: it cuts it into pieces that never cross a 64-byte page end, and never exceed 16 bytes - the Arduino Wire buffer holds only 32 bytes, two of which are the address:

  while (len) {
    uint8_t n = 64 - (addr & 63);
    if (n > 16) n = 16;
    if (n > len) n = len;
    eeWritePage(addr, data, n);

The third reads with a random read: the two address bytes, a repeated START (endTransmission(false)) and then requestFrom(). With those, the sketch runs five steps: the boot counter at 0x0000, the message at 0x0040, the page trap at 0x00F8, the log at 0x0200, and the check of the log.

AT24C256 Simulation Results

Open the project and press Run. The demo runs 4.5 simulated seconds and took about a minute and a half on our PC with the pop-up open and the pictures being taken. Click the module for its pop-up. Every number below comes from one simulation run, the demo exactly as it ships, starting from a new chip.

The Boot Counter and the Write Cycle

The first thing the sketch reads is the counter at 0x0000, and it reads 0xFFFF: an erased cell holds all ones, so the sketch knows it is talking to a new chip, starts from zero and writes 1 back. Then it times the write cycle by ACK polling. The chip refused its address 38 times and answered 5,068 microseconds after the STOP - the model's 5.0 ms plus the last poll. Each poll is a START, one address byte and a STOP, about 130 microseconds at 100 kHz, which is why 38 of them fit in 5 ms. The event log shows the first two: "addressed 0.10 ms into the write cycle: NACK".

The Message

The 67-byte message goes to 0x0040 in 5 page writes - 16, 16, 16 and 16 bytes into page 1, then the last 3 into page 2 at 0x0080. The event log times them at 165.1, 172.1, 179.2, 186.2 and 191.9 ms: 7 ms apart, the 5 ms write cycle plus about 2 ms for the 19 bytes on the bus. The random read brings the whole sentence back unchanged: "Hello from The Engineering Projects! This text lives in the EEPROM."

Falling Into the Page Trap

First the sketch writes 0xFF over 0x00C0 and 0x0100, so nothing left over from an earlier run can fool it. Then it sends "PAGE-TRAP!" - 10 bytes - in a single write at 0x00F8. Reading 10 bytes back from 0x00F8 gives "PAGE-TRA??": the first eight are there, and the next two are 0xFF - nothing went to 0x0100. Where did they go? The read at 0x00C0 answers it: "P!", the start of the same page. The event log flags it in red: "10 bytes at 0x00F8 crossed the page end: 2 rolled over to 0x00C0". Then eeWrite() does it properly, 8 bytes and 2 bytes, and the read gives "PAGE-TRAP!". The pop-up at 0.45 s shows all three pieces in one hex view: "P!" at 0x00C0, "PAGE-TRA" at 0x00F8 and the correct "P!" at 0x0100, the last write in green and the address counter at 0x0102 in orange.

AT24C256 Proteus simulation pop-up: the message and the page trap in the hex view
Figure: The message and the page trap.
AT24C256 Proteus simulation: the EEPROM module running
Figure: The module running.
The AT24C256 EEPROM simulation running in the Proteus workspace
Figure: The simulation in the workspace.

The Data Log

The log writes two 8-byte records at a time, one record every 100 ms, so each page write carries 16 bytes and the four pages from 0x0200 to 0x02FF fill in 16 writes. The monitor marks every eighth record: record 7 at 1133 ms, 15 at 1961 ms, 23 at 2790 ms and 31 at 3618 ms. At 1.8 s the memory map shows pages 8 and 9 in green with the last write in orange, and the hex view shows the records themselves: the first one starts 9C 01 00 00 - 412 ms, stored with the least significant byte first, exactly as the UNO keeps a 32-bit number in its own memory.

AT24C256 Proteus simulation pop-up: the data log filling the pages
Figure: The log filling the pages.

Reading It Back

The sketch reads all 32 records back and checks each one's number and checksum: 32 of 32 records OK. The whole run took 27 page writes (377 bytes) and 347 bytes read in 39 random reads, and the sketch polled the chip 1,026 times while it was writing - about 38 polls for every page. At the end 337 bytes of the 32,768 hold something other than 0xFF, and the address counter sits at 0x0300, right after the last byte read.

AT24C256 Proteus simulation pop-up: the log written and read back
Figure: The log read back.

Run It Again

Now stop the simulation and press Run again. The memory file is still there, so the chip starts with the first run's contents, and the sketch prints no "new chip" line this time: it reads 1 and writes Boot count: 2. The pop-up shows the difference at a glance: at 0.14 s the pages from the first run are blue - data from before - while the pages written in this run turn green one by one, and the banner reads "WRITING page 2 - 2.2 ms left; the chip answers nothing until then". Everything else repeats exactly: 38 NACKs per write, 32 of 32 records. That is non-volatile memory, in a simulation.

AT24C256 Proteus simulation pop-up: the second run starts with the memory the first one left
Figure: The second run.

The Graphs, the Event Log and the Check Page

The Graphs page plots the write cycles as pulses, the address counter jumping between the areas, and the bytes written and read climbing step by step. The Event log lists the page writes, the first ACK polls and the page trap with its warning. The Check page sums up the run: the supply at 5.00 V and the chip at 0x50; 27 page writes and 377 bytes, with the one page roll-over marked in orange - the trap the sketch set on purpose; 1,026 polls during the write cycles; 347 bytes in 39 reads, every one of them a random read; WP OFF with nothing refused; and INIT KEEP, started as a new chip.

AT24C256 Proteus simulation graphs: the write cycles, the address counter, the bytes written and read
Figure: The Graphs page.
AT24C256 Proteus simulation Event log: page writes, ACK polling and the page trap
Figure: The Event log.
AT24C256 Proteus simulation Check page after the demo run
Figure: The Check page.

The monitor tells the story in order: "Counter reads 0xFFFF: a new (erased) chip", "Boot count: 1", "Write cycle: 38 NACKs, ready after 5068 us", the message and its read-back, the page trap with "PAGE-TRA??" and "P!", the split write with "PAGE-TRAP!", the log every eighth record, and finally "Log read back: 32 of 32 records OK".

Arduino UNO V4.0 serial monitor in the AT24C256 Proteus simulation: the boot counter, the message, the page trap and the log
Figure: The Arduino's monitor.

The UNO Has an EEPROM Already - Why Add One?

The UNO's microcontroller has 1 KB of EEPROM inside, and the Arduino EEPROM library makes it easy to use. The 24C256 adds 32 times as much, and a few other things: it stays with the module when you swap the board, several boards can read the same memory, and a log that fills it does not wear out the microcontroller you cannot replace. Many modules carry one already - the DS3231 board from our DS3231 RTC Module Library for Proteus has a smaller cousin of this chip next to the clock. For megabytes, a card from our Micro SD Card Module Library for Proteus is the next step; for settings and logs of a few thousand records, an I2C EEPROM is simpler, cheaper and needs no file system.

Writing Without Wearing It Out

A million writes sounds endless until a loop writes the same byte every 10 ms: that is less than three hours. Write only when a value changes, spread a log over the whole memory instead of one page, and keep a checksum on records that matter - the demo's log does exactly that, and a record cut short by a power failure during the 5 ms write cycle shows up as a bad checksum instead of a wrong value.

Try It Yourself

  • Run the simulation two or three times: the boot count goes up each time. Then set INIT to ERASED and run again.
  • Set WP to ON - or click the WP jumper while the simulation runs: the writes get a NACK and the log stays empty.
  • Change the 16 in eeWrite() to 30 and watch the page writes in the Check page drop.
  • Remove the eeWait() call from eeWritePage(): the next write arrives during the write cycle and is NACKed.
  • Set ADDRESS to 3 and change EE to 0x53 in the sketch: the jumpers on the board follow.

Ideas to Extend the Demo

  • A real data logger: a temperature sensor and the DS3231 clock, a time-stamped record every minute.
  • A ring buffer over all 512 pages with a pointer that survives resets.
  • Settings with a version number and a CRC, and defaults when the CRC fails.

Your Own Sketches

The demo sketch is in the zip file, and you can change it in the Arduino IDE. New to Arduino? Start with our Arduino Tutorial for Beginners. Export the compiled binary, and set the UNO's PROGRAM property to the new file. Our guide on How to get the HEX file from Arduino shows you where the file ends up.

Things to Know Before Using a Real AT24C256

  • Pull-ups: the module has them; a bare chip needs 4.7 kohm on SDA and SCL.
  • Page ends: split writes at multiples of 64 bytes.
  • The write cycle: poll or wait 5 ms before the next access.
  • WP: leave it open or tie it to GND to write; tie it to VCC to protect.
  • Endurance: about a million writes per byte - do not write in a fast loop.

Troubleshooting

  • Every read returns 0xFF: nothing has been written there yet, or INIT is ERASED.
  • Bytes of a long write are in the wrong place: the write crossed a page end and rolled over - the event log names the page.
  • Writes do nothing: WP is ON, or the sketch started the next transfer without a STOP.
  • The chip does not answer right after a write: the write cycle - use ACK polling.
  • No answer at all: the address in the sketch does not match ADDRESS, or VCC is not connected.
  • The part is not simulated: TEPAT24C256.DLL is missing from MODELS and from the project folder.

Limitations of the Simulation

  • The protocol - the word address, the page buffer and its roll-over, the write cycle, ACK polling, the reads, WP - follows the 24C256 datasheets; the module is our own drawing.
  • Our own figure: the write cycle always takes 5.0 ms, the datasheet's maximum.
  • INIT KEEP stores the memory in one file per part name on your PC (the README gives the path).
  • Not modelled: the wear of the cells, the timing limits of 1 MHz Fast-mode Plus.
  • Arduino is a name of Arduino; this library is not made or endorsed by Arduino, Labcenter or the chip's maker.
  • Tested in Proteus 8.5 in November 2026 (the demo as shipped). Proteus 7 is not supported.

So, that was all about the AT24C256 EEPROM Library for Proteus Simulation. I hope it helps you give your projects a memory - and saves you from the page trap before it costs you an afternoon. If you have any questions, ask in the comments and I will help you out. Till the next tutorial, take care and have fun!


Comments

0

Join the conversation