Max Gadget, GPG Dragon Latest Version, Install Android, Sony Xperia, Xiaomi Mi Robot Vacuum, Verizon, Android Marshmallow, Network, stock firmware

Kamis, 01 Desember 2011

LCD 16x2 interface with 8051

LCD 16x2 interface with 8051 - this blog we have built a few years ago and already very many blog visitors Max Gadget who are satisfied with the information we convey and we say thanks for that, we will then improve the quality of information we convey to you, well according to what you are looking for we will now discuss first about LCD 16x2 interface with 8051 this information we framework from various trusted sources, please see:

Articles : LCD 16x2 interface with 8051
full Link : LCD 16x2 interface with 8051
Article Embedded Zone,

You can also see our article on:


LCD 16x2 interface with 8051

Hi,
today our task is how to interface LCD(16x2) with 8051.
hear we are using tow good software keil and proteus which will given on same blog.



The LCD Module can easily be used with an 8051 microcontroller . The LCD Module comes with a 16 pin connector. This can be plugged into connector 16 pin. The pins on the 16 pin connector of the LCD Module are defined below.




The LCD Character standard requires 3 control lines as well as either 4 or 8 I/O lines for the data bus. The user may select whether the LCD is to operate with a 4-bit data bus or an 8-bit data bus. If a 4-bit data bus is used the LCD will require a total of 7 data lines (3 control lines plus the 4 lines for the data bus). If an 8-bit data bus is used the LCD will require a total of 11 data lines (3 control lines plus the 8 lines for the data bus).

The three control lines are referred to as EN, RS, and RW.

The EN line is called "Enable." This control line is used to tell the LCD that you are sending it data. To send data to the LCD, your program should make sure this line is low (0) and then set the other two control lines and/or put data on the data bus. When the other lines are completely ready, bring EN high (1) and wait for the minimum amount of time required by the LCD datasheet (this varies from LCD to LCD), and end by bringing it low (0) again.

The RS line is the "Register Select" line. When RS is low (0), the data is to be treated as a command or special instruction (such as clear screen, position cursor, etc.). When RS is high (1), the data being sent is text data which sould be displayed on the screen. For example, to display the letter "T" on the screen you would set RS high.

The RW line is the "Read/Write" control line. When RW is low (0), the information on the data bus is being written to the LCD. When RW is high (1), the program is effectively querying (or reading) the LCD. Only one instruction ("Get LCD status") is a read command. All others are write commands--so RW will almost always be low.

Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation selected by the user). In the case of an 8-bit data bus, the lines are referred to as DB0, DB1, DB2, DB3, DB4, DB5, DB6, and DB7.

An Example Hardware Configuration
As we've mentioned, the LCD requires either 8 or 11 I/O lines to communicate with. For the sake of this tutorial, we are going to use an 8-bit data bus--so we'll be using 11 of the 8051's I/O pins to interface with the LCD.


LCD command coad:


now simple program for LCD :

LCD.C

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

void main()
{

lcdinit();
lcddatas(1,"ramoliyabiren");
lcddelay(50);
lcdrotade(1,'r',"maxyaquos.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://maxyaquos.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 hear.

so keep exploring 8051.....

see video of emulation