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.

16 * 2 LCD interfacing with NXP 89v51rd2

Status
Not open for further replies.

krishnaraj.jadav

Newbie level 2
Joined
Mar 12, 2013
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
rajkot
Activity points
1,297
I am using 89v51rd2 NXP controller.I prepared whole circuit but when i run my circuit nothing happen.
I am confuse whether i used wrong port for pins.Please help me out from this problem

port 1 pins

rs-p1^0
e-p1^2
rw-ground

Port 2 pins

D0 to D7- port 2
View attachment lcd kraj.bmp

Code:

#include<reg51.h>

void delay(int);
void lcdinit(void);
void writecmd(int);
void writedata(char);

sbit RS=P1^0;
sbit E=P1^1;


void main(void)
{

lcdinit(); //Initilize LCD

writedata('k'); //write
writedata('r'); //write
writedata('i'); //write
writedata('s'); //write
writedata('h'); //write
writedata('n'); //write
writedata('a'); //write
writedata('r'); //write
writedata('a'); //write
writedata('j'); //write

while(1)
{
}

}

void writedata(char t)
{
RS = 1; // => RS = 1
P2 = t; //Data transfer
E = 1; // => E = 1
delay(150);
E = 0; // => E = 0
delay(150);
}


void writecmd(int z)
{
RS = 0; // => RS = 0
P2 = z; //Data transfer
E = 1; // => E = 1
delay(150);
E = 0; // => E = 0
delay(150);
}

void lcdinit(void)
{
writecmd(0x38); //function set
writecmd(0x0c); //display on,cursor off,blink off
writecmd(0x01); //clear display
writecmd(0x80);
writecmd(0x06); //entry mode, set increment

}

void delay(int a)
{
int i;
for(i=0;i<a;i++); //null statement
}
 

140320131282.jpg

Finally Circuit Run :)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top