/* 区域清除,清除从(x,y)坐标起始的len个字符位 */ void LcdAreaClear(unsigned char x, unsigned char y, unsigned char len) { LcdSetCursor(x, y); //设置起始地址 while (len--) //连续写入空格 { LcdWriteDat(' '); } }
/* 在液晶上显示字符串,(x,y)-对应屏幕上的起始坐标,str-字符串指针 */ void LcdShowStr(unsigned char x, unsigned char y, unsigned char *str) { LcdSetCursor(x, y); //设置起始地址 while (*str != '\0') //连续写入字符串数据,直到检测到结束符 { LcdWriteDat(*str++); } }
/******************************************* 函数名称:Lcd1602PutStrXY(uint8 u8Xpos, uint8 u8Ypos, uint8 *u8pStr) 功 能:在屏幕 X,Y 位置显示一个字符 参 数:u8Xpos,u8Ypos,位置坐标 uint8 *u8pStr 字符串指针 返回值 :无 ********************************************/ void Lcd1602PutStrXY(uint8 u8Xpos, uint8 u8Ypos, uint8 *u8pStr) { Lcd1602LocateXY(u8Xpos, u8Ypos); while(*u8pStr!= '\0'){ //以'\0'界定字符串结束 LcdWriteDat( *u8pStr++ ); u8Xpos++; if(u8Xpos > 15) //判断字符数是否超出第一行 { u8Xpos = 0; u8Ypos++; Lcd1602LocateXY(u8Xpos,u8Ypos); } } }
/******************************************* 函数名称:Lcd1602PutNCharXY(uint8 u8Xpos,uint8 u8Ypos, uint8 u8CharNum, uint8 *pu8Str) 功 能:在屏幕 X,Y 位置显示 N 个字符 参 数:u8Xpos,u8Ypos,位置坐标 u8CharNum,字符个数 uint8 *u8pStr 字符串指针 返回值 :无 ********************************************/ void Lcd1602PutNCharXY(uint8 u8Xpos,uint8 u8Ypos, uint8 u8CharNum, uint8 *pu8Str) { Lcd1602LocateXY(u8Xpos, u8Ypos); while( u8CharNum-- > 0) { LcdWriteDat( *pu8Str++ ); u8Xpos++; if(u8Xpos > 15) //判断字符数是否超出第一行 { u8Xpos = 0; u8Ypos++; Lcd1602LocateXY(u8Xpos,u8Ypos); } } }
void ledWriteSingeByte(unsigned char x, unsigned char y, unsigned char dat){ LcdSetCursor(x, y); //设置起始地址 LcdWriteDat(dat); }
/******************************************* 函数名称:Lcd1602PutCharXY(uint8 u8Xpos, uint8 u8Ypos, uint8 u8Char) 功 能:在屏幕 X,Y 位置显示一个字符 参 数:u8Xpos,u8Ypos,位置坐标 u8Char 要显示的字符 返回值 :无 ********************************************/ void Lcd1602PutCharXY(uint8 u8Xpos, uint8 u8Ypos, uint8 u8Char) { Lcd1602LocateXY(u8Xpos, u8Ypos); LcdWriteDat(u8Char); }