高亮(一)
声明
char buf[21];unsigned char upled=0x04;uint8_t key_val;uint8_t key_down,key_up,key_old;uint32_t key_time;uint8_t key_temp,key_flag;uint8_t line_flag;
按键代码
void key_proc(void)
{
key_val=key_scan();key_down=key_val&(key_val^key_old);key_up=~key_val&(key_val^key_old);key_old=key_val;
if(key_down==4)
{line_flag++;if(line_flag==4){line_flag=1;}
}
}
lcd高亮显示代码
注意:此段代码if-else的括号范围
void lcd_proc(void)
{ if(line_flag==1){LCD_SetTextColor(Green);}else{LCD_SetTextColor(Black);}
LCD_DisplayStringLine(Line1,(uint8_t*)("11111111111"));if(line_flag==2){LCD_SetTextColor(Green);}else{LCD_SetTextColor(Black);}
LCD_DisplayStringLine(Line2,(uint8_t*)("22222222222")); if(line_flag==3){LCD_SetTextColor(Green);}else{LCD_SetTextColor(Black);}
LCD_DisplayStringLine(Line3,(uint8_t*)("33333333333"));}
高亮(二)
LCD_Clear(White);LCD_SetBackColor(White);LCD_SetTextColor(Black);
lcd
void lcd_proc(void)
{ if(line_flag==1){LCD_SetBackColor(Yellow);}else{LCD_SetBackColor(White);}
LCD_DisplayStringLine(Line1,(uint8_t*)("11111111111"));if(line_flag==2){LCD_SetBackColor(Yellow);}else{LCD_SetBackColor(White);}
LCD_DisplayStringLine(Line2,(uint8_t*)("22222222222")); if(line_flag==3){LCD_SetBackColor(Yellow);}else{LCD_SetBackColor(White);}
LCD_DisplayStringLine(Line3,(uint8_t*)("33333333333"));}
多页码
声明
LCD_Clear(White);LCD_SetBackColor(White);LCD_SetTextColor(Black);
LCD_DisplayStringLine(Line3,(uint8_t*)("w e l c o m e"));
lcd代码
void lcd_proc(void)
{ if(lcd_page==1){LCD_DisplayStringLine(Line3,(uint8_t*)("w e l c o m e"));}if(lcd_page==2){if(line_flag==1){LCD_SetBackColor(Yellow);}else{LCD_SetBackColor(White);}
LCD_DisplayStringLine(Line1,(uint8_t*)("11111111111"));if(line_flag==2){LCD_SetBackColor(Yellow);}else{LCD_SetBackColor(White);}
LCD_DisplayStringLine(Line2,(uint8_t*)("22222222222")); if(line_flag==3){LCD_SetBackColor(Yellow);}else{LCD_SetBackColor(White);}
LCD_DisplayStringLine(Line3,(uint8_t*)("33333333333"));}}
按键
void key_proc(void)
{
key_val=key_scan();key_down=key_val&(key_val^key_old);key_up=~key_val&(key_val^key_old);key_old=key_val;if(key_down==3)
{ LCD_Clear(White);lcd_page++;if(lcd_page==3){lcd_page=1;}
}
if(key_down==4)
{line_flag++;if(line_flag==4){line_flag=1;}
}
}