Toll-Free Customer Support 24/7

ARM Development Board-LPC2129

/*
* Project name:
ARM Development Board-LPC2129
* Copyright
(c) Researchdesignlab.com
* Description:

* Test configuration:
MCU: LPC2129
Dev.Board: LPC2129 mini
Oscillator: 12 MHz
Software: Keil uVision4

*/

#include<stdio.h>
#include"lpc21xx.h" // header file
#include<string.h>

void DELAY (void);

void SEND_2_LCD(unsigned char *PTR, unsigned char POS);
void SEND_CMD_2_LCD(unsigned char); // function protoype
void DISPLAY_ON_LCD(unsigned char DATA);

unsigned int LCD_RS=0X01000000;
unsigned int LCD_EN=0X02000000;
unsigned int LCD_DATA_LINES=0X00003C00;


int main()
{

unsigned char LCD_CMD[]={0X20,0X28,0X0F,0X06,0X01,0X80},COUNT ;

IODIR0|=0X00003C00;

IODIR1|=0X03000000;

DELAY();
for(COUNT=0;COUNT<6;COUNT++)
SEND_CMD_2_LCD(LCD_CMD[COUNT]); // LCD INIT function call


while(1)
{
SEND_2_LCD(" RDL....",0X80);
SEND_2_LCD("LCD DISPLAY",0XC0);
DELAY();
}

}


void LCD_DELAY()
{
unsigned int X=20000;
while(X--);
}

 


void DELAY()
{
unsigned int x=1000000;
while(x--) ;

}

void SEND_CMD_2_LCD(unsigned char DATA)
{
unsigned int TEMP; // LCD command write function
IOCLR0=LCD_DATA_LINES;
TEMP=DATA;
TEMP=((TEMP&0xf0)<<6);
IOCLR1=LCD_RS;
IOSET0=TEMP;
IOSET1=LCD_EN;
LCD_DELAY();
LCD_DELAY();
IOCLR1=LCD_EN;
IOCLR0=LCD_DATA_LINES;

LCD_DELAY();

TEMP=DATA;
TEMP=((TEMP&0x0f)<<10);
IOCLR1=LCD_RS;
IOSET0=TEMP;
IOSET1=LCD_EN;
LCD_DELAY();
LCD_DELAY();
IOCLR1=LCD_EN;
IOCLR0=LCD_DATA_LINES;
}
//********************************************************************
void DISPLAY_ON_LCD(unsigned char DATA)
{
unsigned int TEMP;
IOCLR0=LCD_DATA_LINES;
TEMP=DATA; //LCD data write function
TEMP=((TEMP&0xf0)<<6);
IOSET1=LCD_RS;
IOSET0=TEMP;
IOSET1=LCD_EN;
LCD_DELAY();
LCD_DELAY();
IOCLR1=LCD_EN;
IOCLR0=LCD_DATA_LINES;

LCD_DELAY();

TEMP=DATA;
TEMP=((TEMP&0x0f)<<10);
IOSET1=LCD_RS;
IOSET0=TEMP;
IOSET1=LCD_EN;
LCD_DELAY();
LCD_DELAY();
IOCLR1=LCD_EN;
IOCLR0=LCD_DATA_LINES;
}

//*************************************************************
void SEND_2_LCD(unsigned char *PTR, unsigned char POS)
{
SEND_CMD_2_LCD(POS);
while(*PTR)
{ // sending the data to LCD data line function
DISPLAY_ON_LCD(*PTR);
PTR++;
}
LCD_DELAY();
LCD_DELAY();
}

 

 

Back to top