LCD 16x2 interfacing with 8051 4-bit mode

LCD 16x2 interfacing with 8051 4-bit mode - we say welcome to you who have been searching for information via search engines such as Google, in a blog Tech Gallery, now we will discuss information about the LCD 16x2 interfacing with 8051 4-bit mode, we have been looking for a lot of information from a trusted and collect it in this blog, so you get the information complete and easy to understand, please read through:

Article Embedded Zone,

You can also see our article on:




Hi,
today we are interface LCD(16x2) with 4 bit mode.
hear we are using tow good software keil and proteus same as older post lcd interfasing.





This article explains interfacing of LCD with 8051 using 4-bit mode. In this mode only four pins are used for sending data and command instructions. This mode has the advantage over the 8-bit mode as it uses less number of pins. The remaining pins of the controller are available for normal use.

The Data or command is sent in nibble form (1 nibble= 4 bit) in the 4-bit mode. The higher nibble is sent first followed by the lower nibble. The function of RS, RW and EN pins remains similar to 8-bit mode.

Circuit description: 
Connections of LCD with 8051 are shown in circuit diagram. In 4-bit mode, the Data lines must be connected with D4, D5, D6 and D7 pins of LCD module.

Initialization: 
The LCD can be configured in 4-bit mode by sending appropriate instruction which is called “Function set” to it. The Function set is hexadecimal instruction for LCD MPU unit, which selects working modes of LCD. The “Function Set” is mentioned in following table:

Instruction
Rs
Rw
D7
D6
D5
D4
D3
D2
D1
D0
Function set
0
0
0
0
1
DL
N
F
-
-
  
Description: 
DL - Data Length (DL = 1 8bit, DL = 0 4bit)
N - No. of Lines (N = 1 2Lines, N = 0 1Lines)
F - Fonts (F = 1 5x10 dots, F = 0 5x7 dots)

According to table, the value of Function Set for 4 –bit mode will be 0010 0000(0x20) because DL=0. The value “Function Set” for the LCD configuration 2 line (N=1), 5X7 dots (F=0) and 4-bit (DL=0) mode will be 0010 1000(0x28).

When the power supply is given to LCD, it remains in 8-bit mode. Now, if 0x20 is sent, lower nibble will not be received by LCD because four data lines (D4-D7) are connected, so 0x02 is sent instead of 0x20.

now simple program for LCD :

LCD.C

#include <reg51.h>
#include <lcd.h>

void main()
{

lcdinit();
lcddatas(1,"ramoliyabiren");
lcddelay(50);
lcdrotade(1,'r',"littlebitjohnny.blogspot.com");
lcdblink(5,"Computer Zone");
while(1) {}


LCD.H

/*

Hi I am Ramoliya Biren.
this program is open use.
for using this hader file.
u need to add this lcd.h in you are source group in keil.
for using fxn

lcddatas(row no,"DATA which u need to desplay"); for desplay string on lcd

lcddata("data(only single char) which u need to desplay on lcd")

lcdblink(no of time u wont to blink data,"data which u wont to blink"); hear data desplay on row 1 only

lcdrotade (row no,'direction of rotaed l or r',"data which u wont to rotaed");

visit : http://littlebitjohnny.blogspot.com/

*/

#ifndef _leddatas_H
#define _leddatas_H

#include <reg51.h>

sfr ldata = 0xA0;
sbit rs = P3^2;
sbit rw = P3^3;
sbit en = P3^4;

void lcddelay (unsigned int itime)
{
 unsigned int i,j;
 for(i=0;i<itime;i++)
 for(j=0;j<1275;j++);
}

void lcdcmd(unsigned char value)
{
 ldata = value;
 rs = 0;
 rw = 0;
 en = 1;
 lcddelay(1);
 en = 0;
}

void lcddata (unsigned char value)
{
 ldata = value;
 rs = 1;
 rw = 0;
 en = 1;
 lcddelay(1);
 en = 0;
}

void lcdinit()
{
 lcdcmd(0x0e);
 lcdcmd(0x01);
 lcdcmd(0x80);
 lcddelay(50);
}

void lcdrow(unsigned char no)
{
 if (no == 1)
 {
  lcdcmd(0x80);
 }
 if (no ==2)
 {
  lcdcmd(0xC0);
 }
}

void lcddatas (unsigned char row,unsigned char *lcdstring)
{
 lcdrow(row);
 while (*lcdstring) 
 {
  lcddata(*lcdstring++);
 }
}

void lcdblink(unsigned char no,unsigned char *lcdstring)
{
 unsigned char j;
 for(j=0;j<no;j++)
 {
 lcdcmd(0x01);
 lcddelay(50);
 lcddatas(1,lcdstring);
 lcddelay(50);
 }
}

void lcdrotade(unsigned char no,unsigned char dir,unsigned char *lcdstring)
{
 unsigned char i;
 lcddatas(no,lcdstring);
 if (dir == 'l')
 {
  for (i=0;i<16;i++)
  {
  lcddelay(100);
  lcdcmd(0x18);
  }
 }
 if (dir == 'r')
 {
  for (i=0;i<16;i++)
  {
  lcddelay(100);
  lcdcmd(0x1C);
  }
 }
}

#endif 


         U can also download all sour coda and also emulation file from here.

so keep exploring 8051.....

see video of emulation 



Information about the LCD 16x2 interfacing with 8051 4-bit mode we have conveyed

A few of our information about the LCD 16x2 interfacing with 8051 4-bit mode, I hope you can exploit carefully

You have finished reading LCD 16x2 interfacing with 8051 4-bit mode and many articles about Tech Gallery in our blog this, please read it. and url link of this article is https://littlebitjohnny.blogspot.com/2012/05/lcd-16x2-interfacing-with-8051-4-bit.html Hopefully discussion articles on provide more knowledge about the world of new tech gadgets.

Tag : ,
Share on Facebook
Share on Twitter
Share on Google+
Tags :

Related : LCD 16x2 interfacing with 8051 4-bit mode

  • Custom characters on 16x2 LCDHi,today we are display Custom characters on 16x2 LCD.hear we are using tow good software keil and proteus same as older post lcd inte ...
  • Keil uVision4 crackedHi my all embedded programmer friends.you enjoy keil3u now time to go ahead.Now u can access keil uVision4 without 2kb error. and also assess all new feat ...
  • Free virtual COM port softwareFree software for virtual COM port is a VSPE.You can download from hear. ...
  • Keil cracked (Uv3)Hi All Embedded Friends.Now you can access keil without 2kb error.Step 1 : just download form this linkStep 2 : and password for SFX is : ramoliyabirenSte ...
  • Proteus 7.7 SP2 with crackHi friends today i will give u virtual platform of electronics..just download form here..and for for manualjust download from here...see u. ...

1 comments: