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

Thu Jan 29 2015, 11:24 AM
durai
I found discussion relevant to my problem (link:http://www.8051projects.net/t59199/gsm-cdma-discussion/flashing-new-firmware-in-sim900-modem.htm) but i could not find the project mentioned in that discusion
Thu Jan 29 2015, 11:21 AM
durai
Hi i am using a SIM/900A GSM modem, I want to send email with an attachement using a microcontroller but when i try to use AT_Email commands it gives me error,I think modem doesnot support those commands,is there any other way to send mail using that modem??
ajay_bhargav
Thu Jan 29 2015, 06:54 AM
@gaurav, please mail me message you're trying to post.
ExperimenterUK
Thu Jan 29 2015, 01:17 AM
bhagyesh.bhavasar/gaurav.k I can post with Firefox. Can you try other browsers ?
naqirizvi
Wed Jan 28 2015, 08:08 AM
the web theme is too much buggy and heavy , admin please change it to simple theme, so that user can browse quickly
naqirizvi
Wed Jan 28 2015, 08:07 AM
some one please share software name or ebooks related to avr
bhagyesh.bhavasar
Tue Jan 27 2015, 11:06 AM
i want to share my project but there is problem occurred during postng
bhagyesh.bhavasar
Tue Jan 27 2015, 05:58 AM
@ExperimentalUK i have used that purple button but same as previous it takes me to blank page
ExperimenterUK
Sun Jan 25 2015, 08:10 PM
This box is for chat. Post problems in a suitable forum
ExperimenterUK
Sun Jan 25 2015, 08:04 PM
@gaurav.k Use the purple "Post reply" button. Green buttons often present a fresh edit box.

Downloads

Comments

sachinmm
Thu Jan 29 2015, 07:09 AM
nawfel
Sat Jan 17 2015, 07:27 AM
Rohi123
Sat Jan 10 2015, 11:00 AM
safakarici
Fri Jan 09 2015, 08:55 PM
Nikita_Pinjare
Thu Jan 08 2015, 03:10 PM
mayank058
Wed Jan 07 2015, 05:43 AM
Overeating
Tue Jan 06 2015, 05:56 AM
trancebreaker11
Sun Jan 04 2015, 07:42 AM

Online

Guests: 61, Members: 0 ...

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

Members: 37574
Newest member: sachinmm
Forum Activity
sachinmm Avatar
Posted By sachinmm
Thu Jan 29 2015, 07:21 AM
hello sir, plz tell me the circuit diagram interfa...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Jan 29 2015, 06:28 AM
Moreover I see the segment Anode is connected via ...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Jan 29 2015, 06:20 AM
LCD tutorial is written for 8051, you need to chan...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Jan 29 2015, 06:17 AM
did you try any data sharing websites like 4shared...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Jan 29 2015, 06:16 AM
you need to vary your PWM from 0 to 100 and then 100 to 0... it will generate sinewave.
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Jan 29 2015, 01:06 AM
The code in http://www.8051projects.net/t37289/805...
Karan123 Avatar
Posted By Karan123
Wed Jan 28 2015, 05:01 AM
Hello,I have changed schematic according to this c...
naqirizvi Avatar
Posted By naqirizvi
Tue Jan 27 2015, 07:10 PM
Have you done anything with devices like the ATme...
naqirizvi Avatar
Posted By naqirizvi
Tue Jan 27 2015, 07:09 PM
I am using avr gcc compiler and avrstudio 4 .I am ...
naqirizvi Avatar
Posted By naqirizvi
Tue Jan 27 2015, 05:43 PM
I have read that tutorial I am using AVR GCC Compi...