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.

Help in LCD Programming with LPC2124

Status
Not open for further replies.

richardlaishram

Member level 4
Joined
Jan 6, 2013
Messages
77
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,298
Location
Planet Earth
Activity points
1,804
I have edited an old 8051 LCD Program for LPC2124 which is not working. Since I'm new to ARM programming I'm not able to rectify it. I have also attached a simulation file (Proteus) as pdf (since I'm not able to upload the DSN file directly) in case it'll be helpful.

#include<lpc21xx.h>

//delay function in msec
void delay(unsigned int msec)
{
int i,j;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}

// Function to send command to LCD
void lcdcmd(unsigned char data)
{
data<<=17; // P1.17 to P1.24 as Data Pins
IOPIN1 = data; // Read current status of Pins
IOSET1 = data;
IOCLR0 = 0x00000010; // P0.4 as RS
IOCLR0 = 0x00000020; // P0.5 as RW
IOSET0 = 0x00000040; // P0.6 as E
delay(1);
IOCLR0 = 0x00000040; // P0.6 as E
return;
}

// Function to send data to LCD
void lcddata(unsigned char data)
{
data<<=17; // P1.17 to P1.24 as Data Pins
IOPIN1 = data; // Read current status of Pins
IOSET1 = data;
IOSET0 = 0x00000010; // P0.4 as RS
IOCLR0 = 0x00000020; // P0.5 as RW
IOSET0 = 0x00000040; // P0.6 as E
delay(1);
IOCLR0 = 0x00000040; // P0.6 as E
return;
}

//send string to LCD
void lcddatastring(unsigned char *str)
{
int i=0;
while(str!='\0')
{
lcddata(str);
i++;
delay(1);
}
return;
}

void lcdinit()
{
lcdcmd(0x00380000); // 2-line 5x7 matrix
delay(2);
lcdcmd(0x000C0000); // Display ON, Cursor Blink
delay(2);
lcdcmd(0x00010000); // Clear Screen
delay(2);
lcdcmd(0x00810000); // Cursor to first position of the first line
delay(2);
}

int main(void)
{
IODIR0&=0xFFFFFFFF; // Port-0 as Output Pins
IODIR1&=0xFFFF0000; // Port-1 17-32 as Output Pins
lcdinit();
lcddatastring("Trial Program");
while(1);
}
 

Attachments

  • LCD.pdf
    18.9 KB · Views: 115

Hello
change your schematic like this
proteus.PNG
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top