key=Remote_Scan(); //红外显示
if(key)
{
switch(key)
{
case 162:
if(point_flag)//有 点
{
price_point_temp = price_point_temp*10+1;
xiaoshuweishu++;xiaoshuweishu=xiaoshuweishu%5;
show_price_point_temp();
}
else
{
price_temp=price_temp*10+1;
ok_flag = 0;
word_len++;
show_price_temp();
}
break;
case 98:
if(point_flag)//有 点
{
price_point_temp = price_point_temp+2/10;
xiaoshuweishu++;
word_len++;
show_price_temp();
}
else
{
price_temp=price_temp*10+2;
ok_flag = 0;
word_len++;
show_price_temp();
}
break;
case 226:
if(point_flag)//有 点
{
price_point_temp = price_point_temp*10+3;
xiaoshuweishu++;
}
else
{
price_temp=price_temp*10+3;
xiaoshuweishu++;
ok_flag = 0;
word_len++;
show_price_temp();
}
break;
case 34:
if(point_flag)//有 点
{
price_point_temp = price_point_temp*10+4;
xiaoshuweishu++;
}
else
{
price_temp=price_temp*10+4;
ok_flag = 0;
word_len++;
show_price_temp();
}
break;
case 2:
if(point_flag)//有 点
{
price_point_temp = price_point_temp*10+5;
xiaoshuweishu++;
}
else
{
price_temp=price_temp*10+5;
ok_flag = 0;
word_len++;
show_price_temp();
}
break;
case 194:
if(point_flag)//有 点
{
price_point_temp = price_point_temp*10+6;
xiaoshuweishu++;
}
else
{
price_temp=price_temp*10+6;
ok_flag = 0;
word_len++;
show_price_temp();
}
break;
case 224:
if(point_flag)//有 点
{
price_point_temp = price_point_temp*10+7;
xiaoshuweishu++;
}
else
{
price_temp=price_temp*10+7;
ok_flag = 0;
word_len++;
show_price_temp();
}
break;
case 168:
if(point_flag)//有 点
{
price_point_temp = price_point_temp*10+8;
xiaoshuweishu++;
}
else
{
price_temp=price_temp*10+8;
ok_flag = 0;
word_len++;
show_price_temp();
}
break;
case 144:
if(point_flag)//有 点
{
price_point_temp = price_point_temp*10+9;
xiaoshuweishu++;
}
else
{
price_temp=price_temp*10+9;
ok_flag = 0;
word_len++;
show_price_temp();
}
break;
case 152:
if(point_flag)//有 点
{
price_point_temp = price_point_temp*10+0;
xiaoshuweishu++;
}
else
{
price_temp=price_temp*10+0;
ok_flag = 0;
word_len++;
show_price_temp();
}
break;
case 56:
if(ok_flag==0)
{
price = price_temp+price_point_temp/(pow(10,xiaoshuweishu));//
// LCD_Fill(130,140,130+60,140+24,WHITE); //背景颜色
// LCD_ShowNum(130,140,price,word_len,24);
printf("price=%f",price);
price_temp = 0;
point_flag = 0;
word_len = 0;
xiaoshuweishu=0;
price_point_temp=0;
}
ok_flag = 1;
break;
case 104:
point_flag = 1;
break;
default:
break;
}
} |