Interfacing LCD and Keypad with PIC16F877A Microcontroller

Interfacing LCD and Keypad are one of the important interfacing concepts of PIC microcontroller since both the input and output element can form a complete embedded system design. This tutorial is about teaching you how to get input input values from keypad by polling method and display the input into a 16×2 LCD.Interfacing LCD and Keypad with PIC16F877A Microcontroller

16×2 LCD:

This type of LCD is widely used to display the status of the system and to display the obtain output. This LCD consists of 16 columns and 2 rows, therefore named as 16×2 LCD. Usually a LCD consists of two built in registers known as Data and Command register. Command reg is meant for giving commands such as blink on, cursor on/off etc while Data reg is to display the input character.

You have to follow these steps to write a command or data into the LCD.

  • Place the Data/Command in the pins D0-D7 of the LCD.
  • If you are intended to write command you gotta make the RS(register select) pin of the LCD low, that is RS=0
  • Whereas for writing data you have to make this RS high, that is RS=1
  • Then the EN of the LCD must undergo a high to low logic transition with some delay in between them, that is EN=1 to EN=0 with specific delay.
  • The R/W pin should remain in the Logic 0.

Schematic Interfacing LCD and Keypad with PIC16F877A Microcontroller

4×3 Keypad:

We have used a 4×3 keypad which means it has four rows and three columns in it. The keypad was scanned for any key inputs and this was done by means of a method called polling. The scanning takes place by keeping a specific Row low at a time and read the status of the column pins as input at that instant. This chain goes on through all the rows and by this way input is read by Microcontroller.

For more detail: Interfacing LCD and Keypad with PIC16F877A Microcontroller

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter