微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > MCU和单片机设计讨论 > 电子称问题

电子称问题

时间:10-02 整理:3721RD 点击:
void press()
{
        do
   {
    dat=get_key();//获取键
        if(dat>=0&&dat<10)
    {   
                count++;
                if(count==1)
                {
                pricetable[0]=dat;
                price_shuzhi(3,pricetable[0]+0x30);
                }
                if(count==2)
                {
                pricetable[1]=pricetable[0];
                price_shuzhi(2,pricetable[1]+0x30);          
                pricetable[0]=dat;
                price_shuzhi(3,pricetable[0]+0x30);//显示单价
                }
                if(count==3)
                {
                pricetable[2]=pricetable[1];
                price_shuzhi(1,pricetable[2]+0x30);
                pricetable[1]=pricetable[0];
                price_shuzhi(2,pricetable[1]+0x30) ;
                pricetable[0]=dat;
                price_shuzhi(3,pricetable[0]+0x30);//显示  
                }
        }
        if(dat==12)
        {
           count--;
          if(count==0)                        //清除
           {price_shuzhi(3,' ');}
          if(count==1)
          {
           pricetable[1]=pricetable[2] ;
          price_shuzhi(3,pricetable[1]+0x30);
          price_shuzhi(2,' ');
          }
         if(count==2)
         {
           pricetable[0]=pricetable[1];
           price_shuzhi(3,pricetable[0]+0x30) ;
           pricetable[1]=pricetable[2];
           price_shuzhi(2,pricetable[1]+0x30);
           price_shuzhi(1,' ');}
         }
        }
        while(dat!=14) ;
}               
为什么实现不了操作个位,输入后按键14确定?急!

                  

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top