In this article, we are going to see how we can store String in the EEPROM of a microcontroller and recall those strings to print on display or use it for different purposes. Usually, we use ROM as the main memory and RAM for variables. But this technique will save you enough space for those and will allow you to utilize the MCU at the maximum point.

Disclaimer: Electricity is always dangerous. Proper skill is required to work with electricity. Do work at your own risk. The author will not be responsible for any misuse or harmful act or any mistake you make. The contents of this website are unique and copyright protected. Kindly don’t do any nonsensical act copying and claiming it as yours. Most of the articles published here are kept as open-source to help you. Take the knowledge for free and use it, but if you are interested you can buy the ready resources offered here. If you need any help or guide feel free to comment below, the author will try to help you. Thanks.

Use of sting in microcontrollers:

String or text what you print on the display while working with microcontrollers. It is not an unknown term to you if you work with a microcontroller. I think all most everyone who worked with microcontrollers faced memory limitation problems while working with microcontrollers due to these ASCII variables or strings.

Here is another article on how you can save RAM & ROM in microcontrollers.

Here is another way to save ROM & RAM and utilize the EEPROM for the variables like String. I think 99% of people who work with microcontrollers did not know this tricks. Even I did not know in the beginning although that was around 2011.

Anyway, let’s find it out how we can utilize the EEPROM for our Strings to save on.

Step1: First create your LCD project like the following:

String in the EEPROM

The text format is given below so don’t panic here. After this step go to tools >> EEPROM editor

String in the EEPROM with PIC microcontroller and mikroC compiler

Then open EEPROM Editor. The window will arrive.

String in the EEPROM with PIC microcontroller and mikroC compiler

Here is the tool you need to edit. Here, the address starts from 0x00 and increments up to 0xFF depending on EEPROM size. But remember these are all 16 bits per line. 0x00 to 0x0F, then 0x10 to 0x1F and so on. Now, you need to edit the text you need.

Click on the EEPROM input Format >> select String. Then set the address to 0000. Then in the next space write your text like this:

String in the EEPROM with PIC microcontroller and mikroC compiler

Now click on the Edit button.

String in the EEPROM with PIC microcontroller and mikroC compiler

Now click on the Save on the right top corner. Overnight if required. Now build the hex in mikroC.

Step 2: testing on simulator:

This editor generates a .ihex file. But if you simulate with Proteus ISIS then you’ll need the bin file. So rename the file into a binary file, .bin. Then open with proteus.

String in the EEPROM with PIC microcontroller and mikroC compiler

Now the text or string that we stored in the EEPROM is on the LCD. Also, check the used RAM & ROM, surprisingly it consumed only a few %. use more of the function disp_text_frm_eeprom(), this % will increase a little only.

mikroC code:

Here is the mikroC file in text format. You can use this function for your code.

Program for, " String on EEPROM code example"
Program written by_ Engr. Mithun K. Das;
MCU:PIC16F690; X-Tal:4Mhz(internal); mikroC pro for PIC v7.6.0; 15-12-21

// LCD module connections
sbit LCD_RS at RC6_bit;
sbit LCD_EN at RC3_bit;
sbit LCD_D4 at RC4_bit;
sbit LCD_D5 at RC5_bit;
sbit LCD_D6 at RA4_bit;
sbit LCD_D7 at RA5_bit;

sbit LCD_RS_Direction at TRISC6_bit;
sbit LCD_EN_Direction at TRISC3_bit;
sbit LCD_D4_Direction at TRISC4_bit;
sbit LCD_D5_Direction at TRISC5_bit;
sbit LCD_D6_Direction at TRISA4_bit;
sbit LCD_D7_Direction at TRISA5_bit;
// End LCD module connections

void disp_text_frm_eeprom(int start_address, int end_address,short row, short colum)
  char txt[16];
  int s=0,n=0;

void main() 
  //set I/O as required
  C1ON_bit = 0;
  C2ON_bit = 0;
  ANSEL = 0x03;
  ANSELH = 0x00;



Here in this video, everything was described. You can check this too.


I think this article will surprise you. Use the maximum of your microcontroller. If you think this article helps you don’t forget to subscribe for the next one. Thanks.


Also let me know what do you want to get as the next article, comment below!

You may check this too: Interfacing External EEPROM with PIC microcontroller


Mithun K. Das; B. Sc. in EEE from KUET; Head of R&D @ M's Lab Engineering Solution. "This is my personal blog. I post articles on different subjects related to electronics in the easiest way so that everything becomes easy for all, especially for beginners. If you have any questions, feel free to ask through the contact us page." Thanks.


Md. Yousuf Molla · December 16, 2021 at 9:22 pm

This post is very helpful for me.
Many many thanks, Sir.

R K Hamy · January 8, 2022 at 3:46 pm

Very useful article.
Many Thanks.

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *