/************************************************************************************************** * @fn HalLcd_HW_Clear * * @brief Clear the HW LCD * * @param None * * @return None **************************************************************************************************/ void HalLcd_HW_Clear(void) { uint8 n; SET_DDRAM_ADDR(0x00); for (n = 0; n < (LCD_MAX_LINE_COUNT * LCD_MAX_LINE_LENGTH); n++) { HalLcd_HW_Write(' '); } }
/************************************************************************************************** * @fn HalLcd_HW_ClearAllSpecChars * * @brief Clear all special chars * * @param None * * @return None **************************************************************************************************/ void HalLcd_HW_ClearAllSpecChars(void) { uint8 n = 0; SET_GCRAM_CHAR(0); for (n = 0; n < (8 * 8); n++) { HalLcd_HW_Write(0x00); } }
/************************************************************************************************** 作用 清屏 **************************************************************************************************/ void HalLcd_HW_Clear(void) { int i,j; for(i=0;i<8;i++){ set_ddram_line_col(i,0); for(j=0;j<128;j++){ HalLcd_HW_Write(0x00); } } }
/********************************************************************* * 函数名称:HalLcd_HW_WriteChar * 功 能:显示ASCII码字符 * 入口参数:line 要显示的字符的行位置 * col 要显示的字符列位置 * text 要显示的ASCII码字符值 * 出口参数:无 * 返 回 值:无 ********************************************************************/ void HalLcd_HW_WriteChar(unsigned char line, unsigned char col, char text) { if (col < LCD_MAX_LINE_LENGTH) { HalLcd_HW_Write(col * LCD_X_WITCH, (line-1) * LCD_Y_WITCH, text); } else { return; } }
/************************************************************************************************** * @fn HalLcd_HW_WriteChar * * @brief Write one char to the display * * @param uint8 line - line number that the char will be displayed * uint8 col - colum where the char will be displayed * * @return None **************************************************************************************************/ void HalLcd_HW_WriteChar(uint8 line, uint8 col, char text) { if (col < LCD_MAX_LINE_LENGTH) { SET_DDRAM_ADDR((line - 1) * LCD_MAX_LINE_LENGTH + col); HalLcd_HW_Write(text); } else { return; } }
/************************************************************************************************** * @fn HalLcd_HW_WriteChar * * @brief Write one char to the display * * @param uint8 line - line number that the char will be displayed * uint8 col - colum where the char will be displayed * * @return None **************************************************************************************************/ void HalLcd_HW_WriteChar(uint8 line, uint8 col, char text) { if (col < HAL_LCD_MAX_CHARS) { SET_DDRAM_ADDR((line - 1) * HAL_LCD_MAX_CHARS + col); HalLcd_HW_Write(text); } else { return; } }
/************************************************************************************************** * @fn HalLcd_HW_Clear * * @brief Clear the HW LCD * * @param None * * @return None **************************************************************************************************/ void HalLcd_HW_Clear(void) { uint8 i,j; for (i = 0; i < 8; i++) { for (j = 0; j < 132; j++) { SET_DDRAM_ADDR(j,i); HalLcd_HW_Write(0); } } }
/* 作用 显示一个字节的字符,该字符大小为宽5个点,高7个点 参数1 page,范围0~7,共8行 参数2 column,范围0~127 参数3 text,要显示的字符,该值为ascii码 */ void DisplayByte_5x7(uint8 page,uint8 column,uint8 text) { int j,k; if((text>=0x20)&&(text<0x7e)){/*需要显示的文字*/ j=text-0x20;/*寻址,通过字符的ascii码找到点阵库中的改字符的位置*/ set_ddram_line_col(page,column); for(k=0;k<5;k++) { HalLcd_HW_Write(ascii_table_5x7[j][k]);/*显示5x7的ASCII字到LCD上,y为页地址,x为列地址,最后为数据*/ } //第六列写入0,即清除上一次留下来的数据 HalLcd_HW_Write(0x00); column+=6; }else if(text==0x00){/*不需要显示,清空指定位置*/ set_ddram_line_col(page,column); for(k=0;k<5;k++){ HalLcd_HW_Write(0x00); //清空指定的字符位置 } } }
/************************************************************************************************** * @fn HalLcd_HW_WriteChar * * @brief Write one char to the display * * @param uint8 line - line number that the char will be displayed * uint8 col - colum where the char will be displayed * * @return None **************************************************************************************************/ void HalLcd_HW_WriteChar(uint8 line, uint8 col, char text) { uint8 j; uint16 addr; uint8 cvt_result; if (col < LCD_MAX_LINE_LENGTH && line <= HAL_LCD_LINE_4) { //write first line SET_DDRAM_ADDR(col * 8, (line - 1) * 2); addr = (text - 0x20)*12; for (j = 0; j < 8; j++) { cvt_result = HalLcd_Convert_DZK(j,addr); cvt_result = cvt_result << 2; HalLcd_HW_Write(cvt_result); } //write second line SET_DDRAM_ADDR(col * 8, (line - 1) * 2 + 1); addr = addr + 6; for (j = 0; j < 8; j++) { cvt_result = HalLcd_Convert_DZK(j,addr); HalLcd_HW_Write(cvt_result); } } else { return; } }
/************************************************************************************************** * @fn HalLcd_HW_SetContrast * * @brief Set display contrast * * @param uint8 value - contrast value * * @return none **************************************************************************************************/ void HalLcd_HW_SetContrast(uint8 value) { SET_ICONRAM_ADDR(CONTRAST_CTRL_REGISTER); HalLcd_HW_Write(value); }