|
按键k2数码管左边数加一,按键k4书数码管右边数加一,按键k5重置,按键k6俩数相加,按键k8俩数相减
void main(void)
{
while(1)
{
if(k2 == 0)
{
int_delay();
if(k2 == 0)
{
LedNumVal1++;
}
}
if(k4 == 0)
{
int_delay();
if(k4 == 0)
{
LedNumVal2++;
}
}
if(k6 == 0)
{
int_delay();
if(k6 == 0)
{
LedNumVal2=LedNumVal1+LedNumVal2;
LedNumVal1 = 0;
}
}
if(k8 == 0)
{
int_delay();
if(k8 == 0)
{
if(LedNumVal1 >= LedNumVal2)
{
LedNumVal2 = LedNumVal1-LedNumVal2;
LedNumVal1 = 0;
}
else
{
j++;
LedNumVal2 = LedNumVal2-LedNumVal1;
LedNumVal1 = 0;
}
}
}
|
评分
-
查看全部评分
|