第九届比赛的按键控制具有一定的复杂度。
1.长按:
if(ucKey_Down > 0)
uwTick_Key_Long_Set_point = uwTick;
if((uwTick - uwTick_Key_Long_Set_point) <= 800)
{
switch(ucKey_Up)
{
}
}
else
{
switch(ucKey_Val)
{
}
}
2.定时器运行、暂停、取消:
短按:
case 4:
if(ucState < 4)
ulSec = ucHour * 3600 + ucMinute * 60 + ucSecond;
if(ucState != 4)
{
ucState = 4;
}
else
ucState = 5;
break;
长按:
case 4:
if(ucState == 4 || ucState == 5)
ucState = 0;
break;
3.LCD_DisplayChar函数的使用:
LCD_DisplayChar(Line5, 224, ucHour / 10 + 0x30);
LCD_DisplayChar(Line5, 208, ucHour % 10 + 0x30);
经测试:从右到左的坐标为(16–320);