Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

LCD interfacing with 89C51

I am working on my final year project "RFID based Access System"..

Here's the code to interface the LCD with 89C51..

Code:
#define cmdpt P3
#define datapt P2
#define q 100
sbit rs = cmdpt^0;  //register select pin
sbit rw = cmdpt^1;  // read write pin
sbit e = cmdpt^6;  //enable pin

void delay(unsigned int msec)  // Function to provide time delay in msec.
{
int i,j ;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}

void lcdcmd(unsigned char item)  //Function to send command to LCD
{
datapt = item;
rs= 0;
rw=0;
e=1;
delay(1);
e=0;
}

void lcddata(unsigned char item)  //Function to send data to LCD
{
dataport = item;
rs= 1;
rw=0;
e=1;
delay(1);
e=0;
}

void main()
{
lcdcmd(0x38);  // for using 8-bit 2 row mode of LCD
delay(100);
lcdcmd(0x0E);  // turn display ON for cursor blinking
delay(100);
lcdcmd(0x01);  //clear screen
delay(100);
lcdcmd(0x06);  //display ON
delay(100);
lcdcmd(0xC7);  // bring cursor to position 6 of line 1
delay(100);
lcddata('D');
}

Comments

Nice code man....I was looking to implement the same in PIC may be I will take a look at your code .... only one small question ......r u used this code in while(1) any time....
 
Sorry Milind, I'm not getting your question...

I suppose you are asking whether it can be used in a while(1) loop all the time..
If so, the answer is yes..
 

Part and Inventory Search

Blog entry information

Author
errakeshpillai
Read time
1 min read
Views
774
Comments
2
Last update

More entries in Uncategorized

More entries from errakeshpillai

Share this entry

Back
Top