?? +
字號:
Set_direction(0);
while(str[strlen])strlen++;
while(str[strlen-i])
{
LCD_Char((x-8*i),y,str[strlen-i],Color,bkColor);
i++;
if(i>=len || i>strlen)return;
}
}
/************************************************************
* 函數(shù)名:LCD_Str_O_P
* 描述 :在指定坐標處懸浮顯示8*16大小的字符串
* 輸入 : -x 顯示位置橫向坐標 0 ~ 319
-y 顯示位置縱向坐標 0 ~ 239
* -str 字符串首址
* -Color字符串顏色
* 輸出 :無
* 舉例 : LCD_Str_O_P(0, 0, "Runing", 0);
LCD_Str_O_P(150, 100, "Runing", 0);
LCD_Str_O_P(320-16, 239-8*6, "Runing", 0);
* 注意 :字符串顯示方向為縱向 已測試
******************************************************************/
void LCD_Str_O_P(u16 x, u16 y,const u8 *str,u16 Color)
{
Set_direction(1);
while(*str != '\0')
{
if(y > (240-8))
{ /* 換行*/
y = 0;
x -= 16;
}
if(x >(320-16))
{ /*重歸起點*/
y = x = 0;
}
LCD_Char_O_P(x,y,*str,Color);
str ++ ;
y += 8 ;
}
}
/******************************************************
* 函數(shù)名:LCD_Num_6x12_O
* 描述 :在指定坐標處懸浮顯示6*12大小的數(shù)字
* 輸入 : -x 顯示位置橫向坐標 0 ~ 319
-y 顯示位置縱向坐標 0 ~ 239
-num 需要顯示的數(shù)字
-Color 數(shù)字顏色
* 輸出 :無
* 舉例 : LCD_Num_6x12_O(200, 100, 65535, BLACK);
LCD_Num_6x12_O(320-5*6, 240-12, 65535, BLACK);
LCD_Num_6x12_O(0, 0, 65535, BLACK);
* 注意 : 顯示方向為橫向 已測試
*********************************************************/
void LCD_Num_6x12_O(u16 x,u16 y,u32 num, u16 Color)
{
u32 res=num;
u8 t=0;
Set_direction(0);
if( num == 0 )
{
LCD_Char_6x12_O(x, y, '0',Color);
return;
}
while( res ) /*得到數(shù)字長度t*/
{
res/=10;
t++;
}
while(num)
{
LCD_Char_6x12_O(x+(6*(t--)-6), y, (num%10)+'0',Color);/*先顯示低位在顯示高位*/
num /= 10 ;
}
}
/******************************************************
* 函數(shù)名:LCD_Str_6x12_O
* 描述 :在指定坐標處懸浮顯示6*12大小的字符串
* 輸入 : -x 顯示位置橫向坐標 0 ~ 319
-y 顯示位置縱向坐標 0 ~ 239
* -str 字符串首址
* -Color字符串顏色
* 輸出 :無
* 舉例 : LCD_Str_6x12_O(300, 10,"LOVE STM32", BLACK);
LCD_Str_6x12_O(0, 0,"LOVE STM32", BLACK);
LCD_Str_6x12_O(320-6*9, 10,"LOVE STM3", BLACK);
LCD_Str_6x12_O(320-6*10, 240-12,"LOVE STM32", BLACK);
* 注意 : 字符串顯示方向為橫向 已測試
*********************************************************/
void LCD_Str_6x12_O(u16 x, u16 y, const u8 *str,u16 Color)
{
Set_direction(0);
while(*str != '\0')
{
if(x > (320-6))
{
//換行
x = 0;
y += 12;
}
if(y > (240-12))
{
//一屏
x = y = 0;
}
LCD_Char_6x12_O(x ,y, *str,Color);
x += 6;
str ++ ;
}
}
/******************************************************
* 函數(shù)名:LCD_Str_6x12_O_P
* 描述 :在指定坐標處懸浮顯示6*12大小的字符串
* 輸入 : -x 顯示位置橫向坐標 0 ~ 319
-y 顯示位置縱向坐標 0 ~ 239
* -str 字符串首址
* -Color字符顏色
* 輸出 :無
* 舉例 : LCD_Str_6x12_O_P(200, 0,"LOVE STM32", 0);
LCD_Str_6x12_O_P(0, 0,"LOVE STM32", 0);
LCD_Str_6x12_O_P(320-12, 239-6*10,"LOVE STM32", 0);
* 注意 : 字符串顯示方向為縱向 已測試
*********************************************************/
void LCD_Str_6x12_O_P(u16 x, u16 y, const u8 *str, u16 Color)
{
Set_direction(1);
while(*str != '\0')
{
if(y > (240-6))
{ /* 換行*/
y = 0;
x -= 12;
}
if(x >(320-12))
{ /*重歸起點*/
y = x = 0;
}
LCD_Char_6x12_O_P(x, y , *str,Color);
y +=6;
str ++ ;
}
}
/********************************************************************
* 函數(shù)名:LCD_Char_CH
* 描述 :顯示單個漢字字符
* 輸入 : x: 0~(319-16)
* y: 0~(239-16)
* str: 中文字符串首址
* Color: 字符顏色
* bkColor: 背景顏色
* 輸出 :無
* 舉例 : LCD_Char_CH(200,100,"好",0,0);
* 注意 :如果輸入大于1的漢字字符串,顯示將會截斷,只顯示最前面一個漢字
************************************************************************/
void LCD_Char_CH(u16 x,u16 y,const u8 *str,u16 Color,u16 bkColor)
{
#ifndef NO_CHNISEST_DISPLAY /*如果漢字顯示功能沒有關閉*/
u8 i,j;
u8 buffer[32];
u16 tmp_char=0;
GetGBKCode_from_sd(buffer,str); /* 取字模數(shù)據(jù) */
for (i=0;i<16;i++)
{
tmp_char=buffer[i*2];
tmp_char=(tmp_char<<8);
tmp_char|=buffer[2*i+1];
for (j=0;j<16;j++)
{
if ( (tmp_char >> 15-j) & 0x01 == 0x01)
{
LCD_ColorPoint(x+j,y+i,Color);
}
else
{
LCD_ColorPoint(x+j,y+i,bkColor);
}
}
}
#endif
}
/******************************************************************
* 函數(shù)名:LCD_Char_CH_P
* 描述 :顯示單個漢字字符
* 輸入 : x: 0~(319-16)
* y: 0~(239-16)
* str: 中文字符串首址
* Color: 字符顏色
* bkColor: 背景顏色
* 輸出 :無
* 舉例 : LCD_Char_CH_P(200,100,"好",0,0);
* 注意 :如果輸入大于1的漢字字符串,顯示將會截斷,只顯示最前面一個漢字
***********************************************************************/
void LCD_Char_CH_P(u16 x,u16 y,const u8 *str,u16 Color,u16 bkColor)
{
#ifndef NO_CHNISEST_DISPLAY /*如果漢字顯示功能沒有關閉*/
u8 i,j;
u8 buffer[32];
u16 tmp_char=0;
Set_direction(1);
GetGBKCode_from_sd(buffer,str); /* 取字模數(shù)據(jù) */
for (i=0;i<16;i++)
{
tmp_char=buffer[i*2];
tmp_char=(tmp_char<<8);
tmp_char|=buffer[2*i+1];
for (j=0;j<16;j++)
{
if ( (tmp_char >> 15-j) & 0x01 == 0x01)
{
LCD_ColorPoint(x+16-i,y+j,Color);
}
else
{
LCD_ColorPoint(x+16-i,y+j,bkColor);
}
}
}
#endif
}
/********************************************************************************
* 函數(shù)名: LCD_Char_CH_O
* 描述 : 懸浮顯示單個漢字字符
* 輸入 : x: 0~(319-16)
* y: 0~(239-16)
* str: 中文字符串首址
* Color: 字符顏色
* 輸出 :無
* 舉例 : LCD_Char_CH_O(200,100,"好",0,0);
* 注意 :1 橫屏2 如果輸入大于1的漢字字符串,顯示將會截斷,只顯示最前面一個漢字
********************************************************************************/
void LCD_Char_CH_O(u16 x,u16 y,const u8 *str,u16 Color)
{
u8 i,j;
u8 buffer[32];
u16 tmp_char=0;
Set_direction(0);
GetGBKCode_from_sd(buffer,str); /* 取字模數(shù)據(jù) */
for (i=0;i<16;i++)
{
tmp_char=buffer[i*2];
tmp_char=(tmp_char<<8);
tmp_char|=buffer[2*i+1];
for (j=0;j<16;j++)
{
if ( (tmp_char >> 15-j) & 0x01 == 0x01)
{
LCD_ColorPoint(x+j,y+i,Color);
}
}
}
}
/******************************************************************************
* 函數(shù)名:LCD_Char_CH_O_P
* 描述 :在Lcd屏上任意位置懸浮顯示一個中文字
* 輸入 : - x: 水平坐標
* - y: 垂直坐標
* - str: 顯示的中文字
* - Color: 字符顏色
* 輸出 :無
* 舉例 : LCD_Char_CH_O_P(200,100,"云",0);
* 注意 : 1 豎屏2 如果輸入大于1的漢字字符串,顯示將會截斷,只顯示最前面一個漢字
*********************************************************************************/
void LCD_Char_CH_O_P(u16 x,u16 y,const u8 *str,u16 Color)
{
#ifndef NO_CHNISEST_DISPLAY /*如果漢字顯示功能沒有關閉*/
u8 i,j;
u8 buffer[32];
u16 tmp_char=0;
Set_direction(1);
GetGBKCode_from_sd(buffer,str); /* 取字模數(shù)據(jù) */
for (i=0;i<16;i++)
{
tmp_char=buffer[i*2];
tmp_char=(tmp_char<<8);
tmp_char|=buffer[2*i+1];
for (j=0;j<16;j++)
{
if ( (tmp_char >> 15-j) & 0x01 == 0x01)
{
LCD_ColorPoint(x+16-i,y+j,Color);
}
}
}
#endif
}
/***************************************************************************
* 函數(shù)名:LCD_Str_CH
* 描述 :在指定坐標處顯示16*16大小的指定顏色漢字字符串
* 輸入 : - x: 顯示位置橫向坐標
* - y: 顯示位置縱向坐標
* - str: 顯示的中文字符串
* - Color: 字符顏色
* - bkColor: 背景顏色
* 輸出 :無
* 注意 : 字符串顯示方向為橫向 已測試
******************************************************************************/
void LCD_Str_CH(u16 x,u16 y,const u8 *str,u16 Color,u16 bkColor)
{
Set_direction(0);
while(*str != '\0')
{
if(x>(320-16))
{
/*換行*/
x =0;
y +=16;
}
if(y >(240-16))
{
/*重新歸零*/
y =0;
x =0;
}
LCD_Char_CH(x,y,str,Color,bkColor);
str += 2 ;
x += 16 ;
}
}
/********************************************************************************
* 函數(shù)名:LCD_Str_CH_P
* 描述 :在指定坐標處顯示16*16大小的指定顏色漢字字符串
* 輸入 : - x: 顯示位置橫向坐標
* - y: 顯示位置縱向坐標
* - str: 顯示的中文字符串
* - Color: 字符顏色
* - bkColor: 背景顏色
* 輸出 :無
* 注意 : 字符串顯示方向為縱向 已測試
**********************************************************************************/
void LCD_Str_CH_P(u16 x,u16 y,const u8 *str,u16 Color,u16 bkColor)
{
Set_direction(1);
while(*str != '\0')
{
if(y >(240-16))
{
y = 0;
x -= 16;
}
if(x >(320-16))
{
y = 0;
x = 0;
}
LCD_Char_CH_P(x,y,str,Color,bkColor);
str += 2 ;
y += 16 ;
}
}
/*********************************************************************************
* 函數(shù)名:LCD_Str_CH_O
* 描述 :在指定坐標處懸浮顯示16*16大小的指定顏色漢字字符串
* 輸入 : - x: 顯示位置橫向坐標
* - y: 顯示位置縱向坐標
* - str: 顯示的中文字符串
* - Color: 字符顏色
* 輸出 :無
* 注意 : 字符串顯示方向為橫向 已測試
***************************************************************************************/
void LCD_Str_CH_O(u16 x,u16 y,const u8 *str,u16 Color)
{
Set_direction(0);
while(*str != '\0')
{
if(x>(320-16))
{
/*換行*/
x =0;
y +=16;
}
if(y >(240-16))
{
/*重新歸零*/
y =0;
x =0;
}
LCD_Char_CH_O(x,y,str,Color);
str += 2 ;
x += 16 ;
}
}
/**********************************************************************************
* 函數(shù)名:LCD_Str_CH_O_P
* 描述 :在指定坐標處懸浮顯示16*16大小的指定顏色漢字字符串
* 輸入 : - x: 顯示位置橫向坐標
* - y: 顯示位置縱向坐標
* - str: 顯示的中文字符串
* - Color: 字符顏色
* 輸出 :無
* 注意 : 字符串顯示方向為縱向 已測試
**************************************************************************************/
void LCD_Str_CH_O_P(u16 x,u16 y,const u8 *str,u16 Color)
{
Set_direction(1);
while(*str != '\0')
{
if(y > 240-16)
{
y = 0;
x -=16;
}
if(x > 320-16)
{
y = 0;
x = 0;
}
LCD_Char_CH_O_P(x,y,str,Color);
str += 2 ;
y += 16 ;
}
}
/**********************************************************************************
* 函數(shù)名:LCD_Str_ENCH_O_P
* 描述 :中英文混合懸浮顯示,英文大小為16*8
* 輸入 : - x: 顯示位置橫向坐標
* - y: 顯示位置縱向坐標
* - str: 顯示的中文字符串
* - Color: 字符顏色
* 輸出 :無
* 注意 : 字符串顯示方向為縱向 已測試
**************************************************************************************/
void LCD_Str_ENCH_O_P(u16 x,u16 y,const u8 *str,u16 Color)
{
u16 Tmp_x, Tmp_y;
Tmp_x = x;
Tmp_y = y;
Set_direction(1);
while(*str != '\0')
{
if(*str<125)
{
if(Tmp_y >(240-8))
{
/*換行*/
Tmp_y =0;
Tmp_x -=16;
}
LCD_Char_O_P(Tmp_x,Tmp_y, *str,Color);
str++ ;
Tmp_y += 8;
}
else
{
if(*str==163) /*163-172 是中文逗號 163-187是中文分號*/
{
LCD_Char_O_P(Tmp_x,Tmp_y, ' ',Color); /*改為顯示1個空格*/
str += 2 ;
Tmp_x += 8 ;
}
if(Tmp_y >(240-16))
{
/*換行*/
Tmp_y =0;
Tmp_x -=16;
}
LCD_Char_CH_O_P(Tmp_x,Tmp_y,str,Color);
str += 2 ;
Tmp_y += 16 ;
}
}
}
/******************* CHD1807 Team *****END OF FILE************/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -