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

ExperimenterUK
Wed Oct 01 2014, 09:33 PM
We're back.. we had a bug, but posting is back to normal
ExperimenterUK
Sat Sep 13 2014, 04:34 PM
jaimin1212,Pimpalkhare Create a thread for your question
jaimin1212
Sat Sep 13 2014, 06:35 AM
i want to make self balancing robot using MPU6050 using atmega8.. please help to get data of gyro and accelerometer from this sensor through atmega8.
Thu Sep 11 2014, 01:00 PM
Sunil Pimpalkhare
Hello sir, I am trying to make Wearfin project https://www.youtube.com/watch?v=iZ6PVBvQf-g so can u help me in teaching how to built the program???
Thu Sep 11 2014, 06:21 AM
hariom panday
plz hlp me in my project
iec.naga
Tue Sep 09 2014, 05:19 AM
spi
Mon Sep 08 2014, 12:14 PM
fameem
water changing in fish tank automatically using microcontoller with timer. send idea to me
dexter_a
Sat Sep 06 2014, 03:09 PM
hello guys
Sat Sep 06 2014, 02:10 PM
munaxa
plx guide me
Sat Sep 06 2014, 02:09 PM
munaxa
hi i want to buy plx guie me

Downloads

Comments

engwas
Tue Sep 30 2014, 12:42 PM
zsachico
Tue Sep 30 2014, 04:18 AM
evergreencare
Sat Sep 27 2014, 07:39 AM
Agnoor
Thu Sep 25 2014, 06:39 AM
fouadzeyad
Tue Sep 23 2014, 09:04 AM
deepbhadani
Fri Sep 19 2014, 05:08 PM
desaiakshay92
Fri Sep 19 2014, 04:45 AM
Fiddu
Thu Sep 18 2014, 06:28 AM

Online

Guests: 51, Members: 0 ...

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

Members: 37522
Newest member: engwas
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Wed Oct 01 2014, 09:30 PM
Sorry about the delay in replying,the website had ...
kirangowle Avatar
Posted By kirangowle
Sat Sep 20 2014, 04:35 AM
Hello All,I want to connect normal speaker (as a s...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed Sep 17 2014, 04:59 AM
I think its important to list out the features of ...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed Sep 17 2014, 04:45 AM
you need to put a wait condition in ISR till the s...
akshar Avatar
Posted By akshar
Mon Sep 15 2014, 08:41 AM
sir,i used microcontroller 89v51rd2 in circuit. No...
bobparihar Avatar
Posted By bobparihar
Mon Sep 15 2014, 06:24 AM
i am programming interrupt 0 using 8051my task is....
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Sep 13 2014, 04:23 PM
There may not be an exact equivalent .You will hav...
akshar Avatar
Posted By akshar
Sat Sep 13 2014, 07:18 AM
Sir, Good Morning,Thank you for making me a member...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Sep 11 2014, 04:52 AM
which compiler are you using? I suggest XC8 with M...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Sep 11 2014, 04:49 AM
I always prefer Olimex Dev boards when it comes to...