static void lcdPrint(char *line){ int i; /* * Show welcome message in LCD-display */ LcdSetCursor(0); LcdClear(); for (i = 0; i < strlen(line); i++) { LcdSetCursor(i); LcdWriteData(line[i]); } }
/* 区域清除,清除从(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++); } }
void digitalClockDisplayLCD() { // digital clock display of the time // Serial /w Debug sprintf(buffer, "$FT,Y0,X0#%04d-%02d-%02d ", year(), month(), day()); Serial.print(buffer); sprintf(buffer, "$FT,Y1,X0#%s W%02d D%03d", dow2String(weekday()), WN, DN); Serial.print(buffer); sprintf(buffer, "$Y5,X0#%02d:%02d:", hour(), minute()); Serial.print(buffer); sprintf(buffer, "$FN,Y5,X35#%02d", second()); Serial.print(buffer); Serial.print(F("$FT#")); // I2C LCD LcdSetCursor(0, 0); sprintf(buffer, "%04d-%02d-%02d %s", year(), month(), day(), dow2String(weekday())); LcdPrint(buffer); sprintf(buffer, "%02d:%02d:%02d W%02d %03d", hour(), minute(), second(), WN, DN); LcdSetCursor(0, 1); LcdPrint(buffer); }
void ledWriteSingeByte(unsigned char x, unsigned char y, unsigned char dat){ LcdSetCursor(x, y); //设置起始地址 LcdWriteDat(dat); }