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

Wed Mar 04 2015, 11:57 AM
Shoukat
What is general purpose card used in metro train prototype.waht is its functionality?
ajay_bhargav
Wed Mar 04 2015, 04:49 AM
@candyyyy, If its about LCD then you can pull down with 1K resistor. dont leave it open
Tue Mar 03 2015, 06:59 AM
candyyyy
Hi! Can i ask how do you connect the Vo contrast pin? Do i leave it open?
ExperimenterUK
Sun Mar 01 2015, 07:06 AM
@Anupam Biswas..post all you have done in the GSM forum
Sat Feb 28 2015, 02:51 PM
Anupam Biswas
I am doinga project on gsm based home automation.I have done alittle study about at commands.I am using Atmel 89c51 with yhe gsm module.I am unable to receive any message via the module.The simulation is done on proteus and i am using a virtual terminal.Can anyone please help me?Thanks in advance.
Tue Feb 24 2015, 12:47 AM
MrCurious
is Stat a global variable too? you reference it in Chan's "disk_status" function.
Sat Feb 21 2015, 09:10 PM
Harikumar
കൊള്ളാം
ExperimenterUK
Fri Feb 20 2015, 06:28 AM
@sugikz.. I have asked Ajay about it, he'll soon sort it out
Thu Feb 19 2015, 12:22 PM
sugikz
"Sorry no bots allowed! You entered two different email addresses. Please enter a valid email address in the two fields provided"
Thu Feb 19 2015, 12:21 PM
sugikz
this are the problem notice box;

Downloads

Comments

Xtens
Wed Mar 04 2015, 11:09 AM
MALIKATIF
Mon Mar 02 2015, 04:47 PM
raamchandran
Mon Mar 02 2015, 11:20 AM
ABiDAEV
Sat Feb 28 2015, 11:31 PM
arunkollam
Wed Feb 25 2015, 05:28 AM
sugikz11
Wed Feb 25 2015, 04:23 AM
Buhari
Sun Feb 22 2015, 03:16 PM
Jarvis_v3
Sat Feb 21 2015, 02:00 AM

Online

Guests: 38, Members: 0 ...

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

Members: 37592
Newest member: Xtens
Forum Activity
steve_yu_chan Avatar
Posted By steve_yu_chan
Wed Mar 04 2015, 02:55 PM
As per the datasheet, if you want to operate load ...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed Mar 04 2015, 04:51 AM
As per the datasheet, if you want to operate load ...
steve_yu_chan Avatar
Posted By steve_yu_chan
Wed Mar 04 2015, 04:18 AM
yes, i following the data sheet typical applicatio...
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Mar 04 2015, 01:38 AM
I follow the LT3652 data sheet (page 26) to connec...
steve_yu_chan Avatar
Posted By steve_yu_chan
Tue Mar 03 2015, 04:32 PM
Dear All ,can you help me to solve the regarding t...
ABiDAEV Avatar
Posted By ABiDAEV
Sun Mar 01 2015, 11:42 AM
Thanks for sharing, but can you please update the ...
sankalp_s Avatar
Posted By sankalp_s
Thu Feb 26 2015, 09:27 PM
What are you trying to make ?ExperimenterUKsir i w...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Feb 26 2015, 12:58 AM
We seem to be moving away from the original projec...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed Feb 25 2015, 02:02 PM
You will need a 64 bytes buffer that will be writt...
PsySc0rpi0n Avatar
Posted By PsySc0rpi0n
Wed Feb 25 2015, 09:24 AM
I've already read that tutorial and almost all oth...