资源描述:
《简易收银台的销售和存储设计》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、#defineucharunsignedcharvoidstore(){while(keyval!='b')//按b键退出存储画面{bitk;uchartemp_position,j;ucharin_isbn[13],write_name[8],write_price[7],write_num[4];ucharread_isbn[13];for(j=0;j<13;j++)in_isbn[j]=0x20;for(j=0;j<8;j++)write_name[j]=0x20;for(j=0;j<7;j++)write_price[j]=
2、0x20;for(j=0;j<4;j++)write_num[j]=0x20;lcd_wcmd(0x01);//清除LCD的显示内容delay(1);PrintStr(0,4,splr,12);//编号PrintStr(2,0,pinming,6);//品名PrintStr(3,0,danjia,5);//单价PrintStr(4,0,shuliang,6);//数量PrintStr(7,13,queren,4);//确认PrintStr(7,3,quxiao,4);//确认//光标在此闪烁提示收银员输入ISBN码PrintStr(
3、1,3,xiahua,13);PrintStr(1,0,isbn,5);//ISBN//光标在此闪烁提示收银员输入ISBN码in_random(1,6,18,in_isbn);rd_24512(read,30,1);//每用到merch_count前要从新读出merch_count=read[0];for(temp_position=1;temp_position4、bn,read_isbn,13)==0){rd_24512(write_name,(temp_position<<5)+13,8);//若ISBN存在则显示其商品信息并且修改数量按确认就写入新的数量rd_24512(write_price,(temp_position<<5)+21,7);rd_24512(write_num,(temp_position<<5)+28,4);PrintStr(2,3,write_name,8);PrintStr(3,3,write_price,7);PrintStr(4,3,write_num,4)
5、;LOCAL_XY(4,6);in_random(4,6,9,write_num);break;}}if(temp_position>=merch_count)//如果不存在{LOCAL_XY(2,6);in_randchar(2,6,13,write_name);LOCAL_XY(3,6);in_price(3,6,12,write_price);LOCAL_XY(4,6);in_random(4,6,9,write_num);}WRITE_COM(0x10,0x6c);//关闭光标keyval='e';k=0;while(key
6、val!='a'){k=~k;if(k){WRITE_COM(0x10,0x4b);PrintStr(7,13,queren,4);WRITE_COM(0x10,0x6b);PrintStr(7,3,quxiao,4);}//确认else{WRITE_COM(0x10,0x4b);PrintStr(7,3,quxiao,4);WRITE_COM(0x10,0x6b);PrintStr(7,13,queren,4);}keyscan();}if(k){if(temp_position>=merch_count){wr_2464(in_
7、isbn,(temp_position<<5),13);wr_2464(write_name,(temp_position<<5)+13,8);wr_2464(write_price,(temp_position<<5)+21,7);wr_2464(write_num,(temp_position<<5)+28,4);merch_count++;//商品数目加一read[0]=merch_count;//wr_2464(read,8190,1);//通过read数组写入24c648190个单元}wr_2464(write_num,(
8、temp_position<<5)+28,4);lcd_wcmd(0x01);//清除LCD的显示内容delay(1);PrintStr(3,1,xxrk,16);//提示信息已经成功输入WRITE_COM(0x10,0x6c);//