In this project “ Interfacing internal EEPROM with PIC Microcontroller ”, we will see how we can easily interface EEPROM, send data from microcontroller, store data in EEPROM and read data from EEPROM. In many time we feel that we need to store some data for long time permanently. For this case we need some additional memory device where we can store data for long time. We can use EEPROM for this purpose. EEPROM stands for Electrically Erasable Programming Read Only Memory. And store data inside EEPROM will live until rewrite the memory place again.

Project description:

In this project “Interfacing internal EEPROM with PIC Microcontroller”, I used internal EEPROM of pic microcontroller and UARTInterfacing Internal EEPROM with PIC Microcontroller Port to receive data which have to be store. For interfacing EEPROM with PIC , see in figure that the internal block diagram of microcontroller and see how internal EEPROM connected with processor. Data from microcontroller is being send serially and store accordingly with given address. So for storing data to EEPROM we should send the address first to store the data. See the command for sending/writing data in EEPROM for Mikroc for PIC is

EEPROM_Write(“address of EEPROM”, Data);

And for reading data from microcontroller is

Take (Unsigned Variable) = EEPROM_Read(“address of EEPROM”);

Now for my project I used UART port to getting data to be store in EEPROM that means through UART port you can attach Keyboard and store the data as you want. For getting knowledge on How to interface UART port with PIC Micrcotroller? See my previous post
Interfacing Proteus with Matlab

See at below the circuit diagram of my complete project where I take input from UART port then store it to EEPROM and read the data from EEPROM and finally display it through LED attached with port B.

Interfacing Internal EEPROM with PIC Microcontroller

In bellow see the embedded C code for Interfacing internal EEPROM with PIC Microcontroller

Embedded C Code
// Name : Automatic street light control by pic microcontroller
// Author : Subham Dutta
// Date : 08-02-14
// Website :
char t;
unsigned int uart_rd=0;
void main()
{ANSEL = 0; // Configure AN pins as digital I/O
C1ON_bit = 0; // Disable comparators
C2ON_bit = 0;
TRISB = 0;
PORTB = 0;
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
while (1)
if (UART1_Data_Ready()) { // If data is received,
uart_rd = UART1_Read();
UART1_Write(uart_rd); // read the received data,}if (uart_rd != 0)
EEPROM_Write(0x02,uart_rd); // Write some data at address 2
t = EEPROM_Read(0x02);
portb = t;