Professional Documents
Culture Documents
C FILE
#include <LPC23xx.H>
#include "LCD.h"
void delay()
{
int i,j;
for (i=0;i<=500;i++)
for (j=0;j<=5000;j++);
}
{
int i;
lcd_init();
lcd_clear();
lcd_write_cmd(0x80);
lcd_print (" hello");
lcd_write_cmd(0xC0);
lcd_print (" hoe are u ");
/* while(1)
{
delay();
lcd_write_cmd(0x1C);
}
*/
return 0;
}
/*********************************************************************
*********/
/* LCD.c: Functions for 2 line 16 character Text LCD, with 4-bit
interface */
/*********************************************************************
*********/
/* PINS:
- DB4 = P1.24
- DB5 = P1.25
- DB6 = P1.26
- DB7 = P1.27
- E = P1.31
- RW = P1.29
- RS = P1.28
*/
/* pin E setting to 0 or 1
*/
#define LCD_E(x) ((x) ? (IOSET1 = PIN_E) : (IOCLR1 =
PIN_E) );
/* pin RW setting to 0 or 1
*/
#define LCD_RW(x) ((x) ? (IOSET1 = PIN_RW) : (IOCLR1 =
PIN_RW));
/* pin RS setting to 0 or 1
*/
#define LCD_RS(x) ((x) ? (IOSET1 = PIN_RS) : (IOCLR1 =
PIN_RS));
/*********************************************************************
*********/
/*********************************************************************
**********
* Delay in while loop cycles
*
* Parameter: cnt: number of while cycles to delay
*
* Return:
*
**********************************************************************
*********/
while (cnt--);
}
/*********************************************************************
**********
* Write 4-bits to LCD controller
*
* Parameter: c: command to be written
*
* Return:
*
**********************************************************************
*********/
/*********************************************************************
**********
* Write command to LCD controller
*
* Parameter: c: command to be written
*
* Return:
*
**********************************************************************
*********/
/*********************************************************************
**********
* Write data to LCD controller
*
* Parameter: c: data to be written
*
* Return:
*
**********************************************************************
*********/
/*********************************************************************
**********
* Print Character to current cursor position
*
* Parameter: c: character to be printed
*
* Return:
*
**********************************************************************
*********/
/*********************************************************************
**********
* Initialize the LCD controller
*
* Parameter:
*
* Return:
*
**********************************************************************
*********/
/*********************************************************************
**********
* Clear the LCD display
*
* Parameter:
*
* Return:
*
**********************************************************************
*********/
/*********************************************************************
**********
* Print sting to LCD display
*
* Parameter: string: pointer to output string
*
* Return:
*
**********************************************************************
*********/
/*********************************************************************
*********/
LCD.H FILE
/*********************************************************************
*********/
/* LCD.h Text LCD function prototypes
*/
/*********************************************************************
*********/