Displaying text on LCD by interfaced with PIC16F877 microcontroller in 4 bit mode

Here I discuss on very good and simple project on displaying text on LCD by interfaced with PIC16F877 microcontroller in 4 bit mode.to start with this project you need some Knowledge on how to start project on PIC micro controller I assumed you know that ifDisplaying text on LCD by interfaced with PIC16F877 microcontroller in 4 bit mode not please you should visit my previous post

Step by step Project guide on PIC Microcontroller

Simple Project on LED blinking by PIC 16 Microcontroller

Now to start with displaying text on LCD by interfaced with PIC16F877 microcontroller in 4 bit mode, we need support of

  • 1 Proteus 7 Professional (where we Make your hardware arrangement our project and simulate it to see the result)
  • 2 Mikcro C. (here we write the Embedded C Program and build the hex file of that)

 

So for making any microcontroller based program you need to build the hardware interfacing first then you can define your interfaced port in programming.

So we start with Proteus 7 Professional 

To build Displaying text on LCD by interfaced with PIC16F877 microcontroller in 4 bit mode, we need to add some device in proteus. Those are

  • 1)      Crystal
  • 2)      Pic16f877
  • 3)      LM016L ( LCD display)

Now how to add, make the interfacing and to see the result of our project how it simulates? see my video in below where I show you step by step.

 

Now in programing portion let see in MiKcro C see what we have to do?

Look from circuit in proteus we can see that we use Port D of PIC16F877 for interfacing with LM016L LCD display board. So we have to make Port d as out port and also we have to initialize port d for LCD. So we use some command to make our project those are

  •       TRIS                                     ( for defining Port as In/Out Port)
  •       LCD_init                              (for initializing port of microcontroller);
  •       LCD_CLEAR                         ( we use this for clear the lcd screen)
  •       LCD_CURSOR_OFF            (to off the cursor of lcd)
  •       LCD_out                              (To out data from micro controller to lcd)

I should mansion that LCD LM016l has 2 rows and 16 columns. So by using these we can display our text in different position. Like if I want to display my name in first Row and first Column then I have to use command for that  LCD_out(1,1,”Subham Dutta “) . Now see the Program of our project “Displaying text on LCD by interfaced with PIC16F877 microcontroller in 4 bit mode” in below.


 See the code of our simple project Displaying text on LCD by interfaced with PIC16F877 microcontroller in 4 bit mode

Embedded C Code
/* Name : lcd interface
* Purpose : Main file for using LCD with PIC16F877 in 4bit mode.
* Author : Subham Dutta
* Date : 07-09-13
* Website : www.nbcafe.in
*/
void main() {
TRISD=0;
LCD_init(&portd);
LCD_cmd(LCD_CLEAR);
LCD_cmd(LCD_CURSOR_OFF);
LCD_out(1,1,”Subham Dutta “);
}
}