You are currently viewing How to 8 Bit Mode LCD Interfacing with 8051 microcontroller using Keil C
Interfacing 16×2 LCD with 8051 microcontroller using Keil is complex because there is no powerful libraries available in Keil C.

How to 8 Bit Mode LCD Interfacing with 8051 microcontroller using Keil C

Spread the love

We know that Liquid Crystal Display (LCD) is a mostly used electronic display module and having a wide range of applications such as Timer, mobile phones, calculators, laptops, etc. 16×2 character lcd display is very basic module which is commonly used in electronics devices and projects.
It can display 2 lines of 16 characters.

Liquid Crystal Display
Liquid Crystal Display

Interfacing 16×2 LCD with 8051 microcontroller using Keil is complex because there is no powerful libraries available in Keil C. To solve this problem we have developed a LCD library which includes commonly used features, you just need to download header file and use it.

Circuit Diagram For 8 Bit Mode LCD Interfacing with 8051 microcontroller

Below Block Diagram or Circuit Diagram show How to Connect 8 Bit Mode LCD Interfacing with 8051 microcontroller

Circuit Diagram For 8 Bit Mode LCD Interfacing with 8051 microcontroller
Circuit Diagram For 8 Bit Mode LCD Interfacing with 8051 microcontroller

Source Code for Interfacing LCD with 8051 microcontroller using Keil C

#include<reg52.h> //including sfr registers for ports of the controller
#include<lcd.h> // Can be download from bottom of this article

//LCD Module Connections
sbit RS = P0^0;
sbit EN = P0^1;
sbit D0 = P2^0;
sbit D1 = P2^1;
sbit D2 = P2^2;
sbit D3 = P2^3;
sbit D4 = P2^4;
sbit D5 = P2^5;
sbit D6 = P2^6;
sbit D7 = P2^7;
//End LCD Module Connections
void Delay(int a)
{
  int j;
  int i;
  for(i=0;i<a;i++)
  {
    for(j=0;j<100;j++)
    {
    }
  }
}
void main()
{
  int i;
  Lcd8_Init();
  while(1)
  {
    Lcd8_Set_Cursor(1,1);
    Lcd8_Write_String("electroSome LCD Hello World");
    for(i=0;i<15;i++)
    {
      Delay(1000);
      Lcd8_Shift_Left();
    }
    for(i=0;i<15;i++)
    {
      Delay(1000);
      Lcd8_Shift_Right();
    }
    Lcd8_Clear();
    Lcd8_Write_Char('e');
    Lcd8_Write_Char('S');
    Delay(3000);
  }
}

Note that : You can also download header file, keil c files and proteus files etc here LCD interfacing with 8051 using Keil C

Summary :

In this article we saw How to 8 Bit Mode LCD Interfacing with 8051 microcontroller using Keil C.

sachin Pagar

I am Mr. Sachin pagar Embedded software engineer, the founder of Sach Educational Support(Pythonslearning), a Passionate Educational Blogger and Author, who love to share the informative content on educational resources.

Leave a Reply