Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

help for lpc2148 lcd program

I wrote a program to display 'a' in a 2*16 lcd with datalines connected to p0.10 to p0.13 as datalines,p1.22 to p1.24 as control lines of lpc2148.Lcd has to be operated in 4 bit mode.The program is as follows(i use keil's mdk):
[CODE]
#include
#define rs 1<<24
#define rw 1<<23
#define en 1<<22
//#define bzr 1<<25
#define dt (0XF)<<10
void cmd(unsigned char);
void dat(unsigned char);
void delay(void);
int main()
{
IODIR1=rs|rw|en;
IODIR0=dt;
cmd(0X2);
cmd(0X8);
cmd(0X0);
cmd(0XE);
cmd(0X0);
cmd(0X1);
cmd(0X0);
cmd(0X6);
cmd(0X8);
cmd(0X0);
dat(0X4);
dat(0X1);
while(1);
}
void cmd(unsigned char c)
{
IOCLR0=dt;
IOSET0=dt&(c<<10);
IOCLR1=rs|rw;
IOSET1=en;
delay();
IOCLR1=en;
delay();
}
void dat(unsigned char d)
{
IOCLR0=dt;
IOSET0=dt&(d<<10);
IOCLR1=rw;
IOSET1=rs|en;
delay();
IOCLR1=en;
delay();
}
void delay(void)
{
unsigned int i;
for(i=0;i<1000;i++);
}
[/CODE]
There is no prob in the kit because i tried a program that one of my frien did and it worked out!!!!i dont know wat is the prob wit my prog......any hlp??????
Sign In or Register to comment.