湖南电气职业技术学院毕业设计 while(P3==0xf0) { get_weight();//得到重量 if(weight>0) {weight_shuzhi(weight);}//显示重量 else {weight_shuzhi(-weight);} }
dat=key_scan(); if(dat>=0&&dat<10) { if(leiji_flag==1) { leiji_weight=leiji_weight+weight; leiji_count++; if(leiji_count==10) leiji_count=0; weizhi_zifu(0x04,0x30+leiji_count); weight_shuzhi(leiji_weight); } *s=dat; price_shuzhi(1,dat+0x30);//显示 s++; } if(dat==16) //去皮 {qi_weight=weight+qi_weight;goto nn;} if(dat==15) //置零 { qi_weight=0; weight=0; price=0; money=0; pricetable[2]=0; pricetable[1]=0; pricetable[0]=0; leiji_flag=0; leiji_weight=0; leiji_count=0; chaozhong_flag=0; clock=1; TR0=0; write_com(0x01);//清屏; init_1602(); system(); 30
湖南电气职业技术学院毕业设计 goto nn; } if(dat==14)//累计 { leiji_flag=1; leiji_weight=leiji_weight+weight; leiji_count++; if(leiji_count==10) {leiji_count=0;} write_com(0x01);//清屏; init_1602(); system(); weizhi_zifu(0x04,0x30+leiji_count); goto nn; }
mm: P3=0xf0; //保存第二位 while(P3==0xf0) { get_weight();//得到重量 if(leiji_flag==1) {weight_shuzhi(leiji_weight);}//如果累计标志为1,显示累计重量 else { if(weight>0) {weight_shuzhi(weight);}//显示重量 else {weight_shuzhi(-weight);} } } dat=key_scan(); if(dat>=0&&dat<10) { *s=dat; price_shuzhi(2,dat+0x30);//显示 s++; }
if(dat==16)
//去皮
{qi_weight=weight+qi_weight;goto mm;} if(dat==12) //清除
{s--;*s=0;price_shuzhi(1,' ');goto nn;} if(dat==15) //置零 { s--; qi_weight=0;
31
湖南电气职业技术学院毕业设计 weight=0; price=0; money=0;
pricetable[2]=0; pricetable[1]=0; pricetable[0]=0; leiji_flag=0; leiji_weight=0; leiji_count=0;
chaozhong_flag=0; clock=1; TR0=0;
write_com(0x01); init_1602();
system();
}
goto nn;}
//清屏;
32