void
lcd_clear(void)
{
	lcd_writecom(0x01);
	delay_ms(2);
	lcd_writecom(0x02);
	delay_ms(2);
}
示例#2
0
/******************************************************************************
function: void lcd_display_string(unsigned char L ,unsigned char *ptr)
introduction: display a string on singal line of LCD.
parameters:L is the display line, 0 indicates the first line, 1 indicates the second line
return value:
*******************************************************************************/
void lcd_display_string(unsigned char line_num, char *ptr, int *semaphorePtr) {
   while (*semaphorePtr != 0) {delay_ms(1);}
   *semaphorePtr = 2;
	if (line_num==0) {		//first line
		lcd_writecom(0x80);
	} else if (line_num==1) {	//second line
		lcd_writecom(0xc0);
	}

	while (*ptr) {
		lcd_writedata(*ptr++);
	}
   *semaphorePtr = 0;
}
示例#3
0
// initialize and clear the display
void lcd_init(void) {
	GPIO_SET = 1<<LCD_RS_GPIO;
	lcd_writecom(0x30);	//wake up
	lcd_writecom(0x39);	//function set
	lcd_writecom(0x14);	//internal osc frequency
	lcd_writecom(0x56);	//power control
	lcd_writecom(0x6D);	//follower control
	lcd_writecom(0x70);	//contrast
	lcd_writecom(0x0C);	//display on
	lcd_writecom(0x06);	//entry mode
	lcd_writecom(0x01);	//clear
	delay_ms(20);
}
/******************************************************************************
function: void lcd_display_string(unsigned char L ,unsigned char *ptr)
introduction: display a string on singal line of LCD.
parameters:L is the display line, 0 indicates the first line, 1 indicates the second line
return value:
*******************************************************************************/
void
lcd_display_string(unsigned char line_num, char *ptr)
{
//	unsigned char i;

	if(line_num==0)		//first line
	{
		lcd_writecom(0x80);
	}
	else if(line_num==1)	//second line
	{
		lcd_writecom(0xc0);
	}

	while (*ptr)
	{
		lcd_writedata(*ptr++);
	}

}