Introduction to 4-bit Mode

Till now whatever we discussed in the previous part of ths LCD tutorial, we were dealing with 8-bit mode. Now we are going to learn how to use LCD in 4-bit mode. There are many reasons why sometime we prefer to use LCD in 4-bit mode instead of 8-bit. One basic reason is lesser number of pins are needed to interface LCD.

In 4-bit mode the data is sent in nibbles, first we send the higher nibble and then the lower nibble. To enable the 4-bit mode of LCD, we need to follow special sequence of initialization that tells the LCD controller that user has selected 4-bit mode of operation. We call this special sequence as resetting the LCD. Following is the reset sequence of LCD.
  1. Wait for abour 20mS
  2. Send the first init value (0x30)
  3. Wait for about 10mS
  4. Send second init value (0x30)
  5. Wait for about 1mS
  6. Send third init value (0x30)
  7. Wait for 1mS
  8. Select bus width (0x30 - for 8-bit and 0x20 for 4-bit)
  9. Wait for 1mS

The busy flag will only be valid after the above reset sequence. Usually we do not use busy flag in 4-bit mode as we have to write code for reading two nibbles from the LCD. Instead we simply put a certain ammount of delay usually 300 to 600uS. This delay might vary depending on the LCD you are using, as you might have a different crystal frequency on which LCD controller is running. So it actually depends on the LCD module you are using. So if you feel any problem running the LCD, simply try to increase the delay. This usually works. For me about 400uS works perfect.

LCD connections in 4-bit Mode




Above is the connection diagram of LCD in 4-bit mode, where we only need 6 pins to interface an LCD. D4-D7 are the data pins connection and Enable and Register select are for LCD control pins. We are not using Read/Write (RW) Pin of the LCD, as we are only writing on the LCD so we have made it grounded permanently. If you want to use it.. then you may connect it on your controller but that will only increase another pin and does not make any big difference. Potentiometer RV1 is used to control the LCD contrast. The unwanted data pins of LCD i.e. D0-D3 are connected to ground.

LCD connections in 4-bit Mode

We will now look into the common steps to send data/command to LCD when working in 4-bit mode. As i already explained in 4-bit mode data is sent nibble by nibble, first we send higher nibble and then lower nibble. This means in both command and data sending function we need to saperate the higher 4-bits and lower 4-bits.


The common steps are:
  1. Mask lower 4-bits
  2. Send to the LCD port
  3. Send enable signal
  4. Mask higher 4-bits
  5. Send to LCD port
  6. Send enable signal

We are done with the theory part now, In the next section we will take a look at the programming microcontroller to control LCD in 4-bit mode.

Share it! Like it!

Conversation

DavesGarage
Tue Jan 09 2018, 11:55 AM
It's been a few years since I poked around here - Hi all...
ExperimenterUK
Mon Jan 08 2018, 11:19 AM
Hi TPS. it's been a while..
۞ TPS ۞
Sun Jan 07 2018, 10:42 AM
hello
Thu Jan 04 2018, 05:50 AM
sayyad affrid
its AT89S52
Thu Jan 04 2018, 05:50 AM
sayyad affrid
sir, i want embedded c code for ultrasonic sensor having buzzer interfaced with AT9S52
Mon Dec 18 2017, 12:12 PM
zafir
i am making digital voltmeter using AT89C51, ADC and LCD 16x2,,, kindly someone please send me hex file in assembly language
Fri Dec 15 2017, 04:18 AM
mehari
can not find dhtxx.md file in proteus 8.0 can anybody help me please?
sahar7478
Fri Dec 08 2017, 04:47 AM
can i get gsm a6 library? can anybody help? tia
Faiqa
Sat Nov 25 2017, 12:32 AM
Can i get the code of Monitering and controlling of green house effect? ... Can anyone help me ?
Wed Nov 08 2017, 05:35 AM
Anirudh jain
I want to burn code in atmel 89s51 24pc 0329 but cannot get the connection with the burner. Can somebody provide me with the circuit diagram for connecting controller to burner. I'm using usb burner

Downloads

Comments

vieslav
Thu Jan 18 2018, 06:19 PM
eddieprice
Fri Jan 12 2018, 04:07 PM
bastik
Fri Jan 12 2018, 09:36 AM
cjj20
Tue Jan 09 2018, 07:29 PM
shahzadiqbal
Tue Jan 09 2018, 01:57 PM
shailu1809
Mon Jan 08 2018, 01:11 AM
saffrid97
Sun Jan 07 2018, 01:48 AM
vietbac
Sat Jan 06 2018, 10:08 AM

Online

Guests: 66, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 37944
Newest member: vieslav
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Jan 13 2018, 10:26 PM
This is clearly an old design.A modern microcontr...
bastik Avatar
Posted By bastik
Sat Jan 13 2018, 09:38 PM
For now I don’t have much information about device...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Jan 12 2018, 06:49 PM
Sometimes the Configuration word has to be program...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Jan 12 2018, 06:30 PM
What exactly is your situation ?I very much doubt ...
eddieprice Avatar
Posted By eddieprice
Fri Jan 12 2018, 04:32 PM
I am using a 16F84A for the first time and am havi...
bastik Avatar
Posted By bastik
Fri Jan 12 2018, 10:37 AM
I have device with SAB80C535 microcontroller and I...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Jan 12 2018, 12:01 AM
I tried to compile your 8051 version in Keil 5but...
cjj20 Avatar
Posted By cjj20
Tue Jan 09 2018, 07:42 PM
I just think something is off in the checkgpgga fu...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Jan 09 2018, 07:35 PM
Why do you think there is something wrong with it...
cjj20 Avatar
Posted By cjj20
Tue Jan 09 2018, 07:32 PM
Please help me correct this code #include ...