8051 – LCD 4 bit Interfacing

Hi dudes…!!! Here i’m came with new tutorial. We have already seen lots of tutorials using LCD. If you want see those tutorials please click Here. In previous LCD tutorials we were used that LCD in 8 bit mode. But here we will see LCD 4 bit interfacing with 8051 Microcontroller. Okay can you tell me what is 8 bit mode and 4 bit mode? Any guess. Well.

LCD 4 bit interfacing with 8051 Microcontroller

Introduction

8 bit mode –  Using 8 data lines in LCD (totally 8 data lines are there)

4 bit mode –  Using only 4 data lines in LCD module 

8 bit mode is already working and that is looks awesome. Then why we are going to 4 bit mode? This is the question comes in every mind whenever i said 4 bit mode. Yeah that 8 bit mode is nice. But but but… Just assume. I’m doing one project which requires more number of hardwares. But 8051 have only 32 GPIOs. So in that time i can use this 4 bit mode and reduce the pin required for LCD module. Am i right? Great. That’s why 4 bit mode also important. Already we know the LED’s operation. If we want to enable 4 bit mode we have to do small modification in normal method. Let’s see that.

In initializing time we have to give 0x28 command. That’s all.

LCD Initializing

Sending command

Here everything is same except way of data writing. Here we have only 4 bits. So we need to send nibble by nibble. So first we need to send first nibble then followed by second. See that code. I’m writing into the Port 2’s last 4 bits. Because last 4 bits are connected into LCD.

Sending Data

Same as sending data.

PIN DIAGRAM

a 8051 - LCD 4 bit Interfacing

RS is connected into P2.0

RW is connected into P2.1

EN is connected into P2.2

4 data lines are connected into P2. 4 to P2.7

CODE

OUTPUT

4bit2 8051 - LCD 4 bit Interfacing

Hope you learned something from this. If you have any doubt please ask us. See you in next tutorials.

Download our new Android app. You can learn all Embedded Tutorials from your Android Phone easily.

Click Here to Download App!