PIC16F84A LCD interfacing code (In 4bit mode) and Proteus simulation

This post provides the LCD[1] interfacing code in 4bit mode using PIC16F84A microcontroller. This code is written in C language using MPLAB with HI-TECH C compiler. You can download this code from the ‘Downloads‘ section at the bottom of this page.

PIC16F84A LCD interfacing 4bit mode

It is assumed that you know how to make an LED blink with PIC16F84A microcontroller. If you don’t then please read this page first, before proceeding with this article.

LCD interfacing circuit in 4bit mode with PIC16F84A is shown below.

In the above figure, RA0 pin is being used as Enable pin for LCD. RA1 pin is used as RS pin and RB4 to RB7 pins are being used as Data bus for the LCD. When code starts runing then Hello is displayed on the LCD.

Any 16×2 LCD can be used here which has HD44780U controller in it. For example, JHD162A LCD can be used with this code easily.



The code for the main function is shown below.

In the main function, firstly LCD is initialized using InitLCD() function. After that, “Hello” is written on the LCD screen[2]. In this way using WriteDataToLCD() function, you can write any character on the LCD screen.

PIC16F84A LCD interfacing 4bit mode schematic

InitLCD() function initializes the LCD[3] by giving the initializing commands required to turn the LCD on. This function is shown below.


LCD interfacing code in 4bit mode using PIC16F84A was compiled in MPLAB v8.85 with HI-TECH C v9.83 compiler and simulation was made in Proteus v7.10. To download code and Proteus simulation click here.


For more detail: PIC16F84A LCD interfacing code (In 4bit mode) and Proteus simulation

READ  PIC16F84A timer0 code and Proteus simulation

JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Get quote online easily: https://jlcpcb.com

Current Project / Post can also be found using:

  • interfacing lcd with PIC16f84A
  • lcd 4 bit pic16f628 circuit

Leave a Comment

= 5 + 3

Read previous post:
Display custom characters on LCD using PIC16F84A
How to display custom characters on LCD using PIC16F84A

This post explains the idea of creating custom characters on any LCD ( e-g on 16x2 LCD ) which has...

Scroll to top