从单片机基础到程序框架(全集 2019pdf版).pdf - 第636页

vGu8Disp lay_Righ_4= Su8Temp_4; / /过渡需要显 示的数据到底 层驱动变量 vGu8Disp lay_Righ_3= Su8Temp_3; vGu8Disp lay_Righ_2= Su8Temp_2; vGu8Disp lay_Righ_1= Su8Temp_1; //不显 示任何一个小 数点 vGu8Disp lay_Righ_Do t_4=0; vGu8Disp lay_Righ_Do t_3=0;…

100%1 / 836
void Wd1(void) //窗口 1 显示函数
{
//需要借用的中间变量,用来拆分数据位。
static unsigned char Su8Temp_4,Su8Temp_3,Su8Temp_2,Su8Temp_1; //需要借用的中间变
if(1==Gu8WdUpdate) //如果需要整屏更新
{
Gu8WdUpdate=0; //及时清零,只更新一次显示即可,避免一直进来更新显示
Su8Temp_4=1; //窗口“1
Su8Temp_3=11; //横杠“-”
Su8Temp_2=Gu8SetData_1/10%10; //十位数
Su8Temp_1=Gu8SetData_1/1%10; //个位数值
//上面先分解数据之后,再过渡需要显示的数据到底层驱动变量里,让过渡的时间越短越好
vGu8Display_Righ_4=Su8Temp_4; //过渡需要显示的数据到底层驱动变量
vGu8Display_Righ_3=Su8Temp_3;
vGu8Display_Righ_2=Su8Temp_2;
vGu8Display_Righ_1=Su8Temp_1;
//不显示任何一个小数点
vGu8Display_Righ_Dot_4=0;
vGu8Display_Righ_Dot_3=0;
vGu8Display_Righ_Dot_2=0;
vGu8Display_Righ_Dot_1=0;
}
}
void Wd2(void) //窗口 2 显示函数
{
//需要借用的中间变量,用来拆分数据位。
static unsigned char Su8Temp_4,Su8Temp_3,Su8Temp_2,Su8Temp_1; //需要借用的中间变
if(1==Gu8WdUpdate) //如果需要整屏更新
{
Gu8WdUpdate=0; //及时清零,只更新一次显示即可,避免一直进来更新显示
Su8Temp_4=2; //窗口“2
Su8Temp_3=11; //横杠“-”
Su8Temp_2=Gu8SetData_2/10%10; //十位数
Su8Temp_1=Gu8SetData_2/1%10; //个位数值
//上面先分解数据之后,再过渡需要显示的数据到底层驱动变量里,让过渡的时间越短越好
vGu8Display_Righ_4=Su8Temp_4; //过渡需要显示的数据到底层驱动变量
vGu8Display_Righ_3=Su8Temp_3;
vGu8Display_Righ_2=Su8Temp_2;
vGu8Display_Righ_1=Su8Temp_1;
//不显示任何一个小数点
vGu8Display_Righ_Dot_4=0;
vGu8Display_Righ_Dot_3=0;
vGu8Display_Righ_Dot_2=0;
vGu8Display_Righ_Dot_1=0;
}
}
void Wd3(void) //窗口 3 显示函数
{
//需要借用的中间变量,用来拆分数据位。
static unsigned char Su8Temp_4,Su8Temp_3,Su8Temp_2,Su8Temp_1; //需要借用的中间变
if(1==Gu8WdUpdate) //如果需要整屏更新
{
Gu8WdUpdate=0; //及时清零,只更新一次显示即可,避免一直进来更新显示
Su8Temp_4=3; //窗口“3
Su8Temp_3=11; //横杠“-”
Su8Temp_2=Gu8SetData_3/10%10; //十位数
Su8Temp_1=Gu8SetData_3/1%10; //个位数值
//上面先分解数据之后,再过渡需要显示的数据到底层驱动变量里,让过渡的时间越短越好
vGu8Display_Righ_4=Su8Temp_4; //过渡需要显示的数据到底层驱动变量
vGu8Display_Righ_3=Su8Temp_3;
vGu8Display_Righ_2=Su8Temp_2;
vGu8Display_Righ_1=Su8Temp_1;
//不显示任何一个小数点
vGu8Display_Righ_Dot_4=0;
vGu8Display_Righ_Dot_3=0;
vGu8Display_Righ_Dot_2=0;
vGu8Display_Righ_Dot_1=0;
}
}
void KeyScan(void) //按键底层的驱动扫描函数,放在定时中断函数
{
static unsigned char Su8KeyLock1;
static unsigned int Su16KeyCnt1;
static unsigned char Su8KeyLock2;
static unsigned int Su16KeyCnt2;
static unsigned char Su8KeyLock3;
static unsigned int Su16KeyCnt3;
if(0!=KEY_INPUT1)
{
Su8KeyLock1=0;
Su16KeyCnt1=0;
}
else if(0==Su8KeyLock1)
{
Su16KeyCnt1++;
if(Su16KeyCnt1>=KEY_FILTER_TIME)
{
Su8KeyLock1=1;
vGu8KeySec=1;
}
}
if(0!=KEY_INPUT2)
{
Su8KeyLock2=0;
Su16KeyCnt2=0;
}
else if(0==Su8KeyLock2)
{
Su16KeyCnt2++;
if(Su16KeyCnt2>=KEY_FILTER_TIME)
{
Su8KeyLock2=1;
vGu8KeySec=2;
}
}
if(0!=KEY_INPUT3)
{
Su8KeyLock3=0;
Su16KeyCnt3=0;
}
else if(0==Su8KeyLock3)
{
Su16KeyCnt3++;