超市储物柜模拟系统C程序Word格式文档下载.docx

上传人:b****5 文档编号:8446433 上传时间:2023-05-11 格式:DOCX 页数:16 大小:18.12KB
下载 相关 举报
超市储物柜模拟系统C程序Word格式文档下载.docx_第1页
第1页 / 共16页
超市储物柜模拟系统C程序Word格式文档下载.docx_第2页
第2页 / 共16页
超市储物柜模拟系统C程序Word格式文档下载.docx_第3页
第3页 / 共16页
超市储物柜模拟系统C程序Word格式文档下载.docx_第4页
第4页 / 共16页
超市储物柜模拟系统C程序Word格式文档下载.docx_第5页
第5页 / 共16页
超市储物柜模拟系统C程序Word格式文档下载.docx_第6页
第6页 / 共16页
超市储物柜模拟系统C程序Word格式文档下载.docx_第7页
第7页 / 共16页
超市储物柜模拟系统C程序Word格式文档下载.docx_第8页
第8页 / 共16页
超市储物柜模拟系统C程序Word格式文档下载.docx_第9页
第9页 / 共16页
超市储物柜模拟系统C程序Word格式文档下载.docx_第10页
第10页 / 共16页
超市储物柜模拟系统C程序Word格式文档下载.docx_第11页
第11页 / 共16页
超市储物柜模拟系统C程序Word格式文档下载.docx_第12页
第12页 / 共16页
超市储物柜模拟系统C程序Word格式文档下载.docx_第13页
第13页 / 共16页
超市储物柜模拟系统C程序Word格式文档下载.docx_第14页
第14页 / 共16页
超市储物柜模拟系统C程序Word格式文档下载.docx_第15页
第15页 / 共16页
超市储物柜模拟系统C程序Word格式文档下载.docx_第16页
第16页 / 共16页
亲,该文档总共16页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

超市储物柜模拟系统C程序Word格式文档下载.docx

《超市储物柜模拟系统C程序Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《超市储物柜模拟系统C程序Word格式文档下载.docx(16页珍藏版)》请在冰点文库上搜索。

超市储物柜模拟系统C程序Word格式文档下载.docx

ucharcodeLCD_Display_Full_i[16]={"

AllFull!

ucharcodeLCD_Display_Full_j[16]={"

PleseWait!

ucharcodeLCD_Display_GetPassw_i[16]={"

YourPassword:

ucharcodeLCD_Display_Box1Password_i[16]={"

Box1Password:

ucharcodeLCD_Display_Box2Password_i[16]={"

Box2Password:

ucharcodeLCD_Display_Box3Password_i[16]={"

Box3Password:

ucharcodeLCD_Display_Box4Password_i[16]={"

Box4Password:

ucharLCD_Display_i[16];

ucharLCD_Display_j[16];

sbita=P3^4;

//定义3x4键盘端口,发送a,b,c,d,扫描x,y,z

sbitb=P3^5;

//

sbitc=P3^6;

sbitd=P3^7;

sbitx=P3^0;

sbity=P3^1;

sbitz=P3^2;

sbitBox1=P3^0;

//defineBox(x)Port定义箱子继电器端口

sbitBox2=P3^1;

sbitBox3=P3^2;

sbitBox4=P3^3;

sbitKey_Box1=P1^4;

//定义箱子的取物按键端口

sbitKey_Box2=P1^5;

sbitKey_Box3=P1^6;

sbitKey_Box4=P1^7;

sbitCus_In=P3^7;

//进超市人数+

sbitCus_Out=P3^6;

//出超市人数-

sbitBee=P2^3;

//蜂鸣器输出端口

sbitShock=P3^5;

//震动输入端口

sbitLCD_E=P3^4;

//define1602E

sbitLCD_RW=P3^6;

//define1602RW

sbitLCD_RS=P3^5;

//define1602RS

uchartemp_a,temp_b,temp_c,temp_d,temp_e,temp_f;

//输入密码暂存变量

ucharNum,Interface,Customer;

//定义各种标志位

ucharPassw_Box1_a,Passw_Box1_b,Passw_Box1_c,Passw_Box1_d,Passw_Box1_e,Passw_Box1_f;

//各箱子的密码移位暂存位

ucharPassw_Box2_a,Passw_Box2_b,Passw_Box2_c,Passw_Box2_d,Passw_Box2_e,Passw_Box2_f;

//

ucharPassw_Box3_a,Passw_Box3_b,Passw_Box3_c,Passw_Box3_d,Passw_Box3_e,Passw_Box3_f;

ucharPassw_Box4_a,Passw_Box4_b,Passw_Box4_c,Passw_Box4_d,Passw_Box4_e,Passw_Box4_f;

ucharShow_P_a,Show_P_b,Show_P_c,Show_P_d,Show_P_e,Show_P_f;

/*----------------------------------------------------------------|

|延时子函数|

voiddelay(uintt)

{

while(t--);

}

|定时器初始化子函数|

voidTimer0_Init()

TMOD=0x01;

//方式选择

TH0=(65535-100)/256;

TL0=(65535-100)%256;

//初值设定

ET0=1;

//开定时器T0的中断

EA=1;

//开总中断

TR0=1;

//启动T0

|LCD子函数|

voidWrite_Bit_Com(ucharcom)//*********写命令*********//

LCD_E=0;

//关闭使能端

LCD_RW=0;

//写命令

LCD_RS=0;

//表示选择命令

P0=com;

//将命令赋给P0口

delay(10);

//等待命令赋完

LCD_E=1;

//给以上升沿开始写命令

//等待命令写完

voidWrite_Bit_Date(uchardate)//*********写数据********//

//写数据

LCD_RS=1;

//表示选择数据

P0=date;

//将数据赋给P0口

//等待数据赋完

//等待数据写完

}

voidInit_LCD()//********初始化液晶*******//

//关闭使能

Write_Bit_Com(0x38);

//设置显示模式

Write_Bit_Com(0x0c);

//开显示,示显示光标,光标不闪烁(不显示不闪烁为0x0d)

Write_Bit_Com(0x06);

//设置显示移动自加1

Write_Bit_Com(0x01);

//清屏

voidDisplay_Common()//常态显示,欢迎语,进出人数计数

uchari,j;

Write_Bit_Com(0x80+0x00);

for(i=0;

i<

16;

i++)

{

Write_Bit_Date(LCD_Display_Common_i[i]);

delay(100);

}

LCD_Display_j[0]=0x30+Customer/10;

LCD_Display_j[1]=0x30+Customer%10;

LCD_Display_j[2]='

'

;

LCD_Display_j[3]='

LCD_Display_j[4]='

LCD_Display_j[5]='

LCD_Display_j[6]='

LCD_Display_j[7]='

LCD_Display_j[8]='

LCD_Display_j[9]='

LCD_Display_j[10]='

LCD_Display_j[11]='

LCD_Display_j[12]='

LCD_Display_j[13]='

LCD_Display_j[14]='

LCD_Display_j[15]='

Write_Bit_Com(0x80+0x40);

for(j=0;

j<

j++)

Write_Bit_Date(LCD_Display_j[j]);

voidDisplay_Input_Box1()//box1passwordinput箱子一密码输入界面

Write_Bit_Date(LCD_Display_Box1Password_i[i]);

LCD_Display_i[0]='

LCD_Display_i[1]='

LCD_Display_i[2]='

LCD_Display_i[3]='

LCD_Display_i[4]='

LCD_Display_i[5]=0x30+temp_f;

LCD_Display_i[6]=0x30+temp_e;

LCD_Display_i[7]=0x30+temp_d;

LCD_Display_i[8]=0x30+temp_c;

LCD_Display_i[9]=0x30+temp_b;

LCD_Display_i[10]=0x30+temp_a;

LCD_Display_i[11]='

LCD_Display_i[12]='

LCD_Display_i[13]='

LCD_Display_i[14]='

LCD_Display_i[15]='

Write_Bit_Date(LCD_Display_i[j]);

voidDisplay_Input_Box2()//box2passwordinput箱子二密码输入界面

Write_Bit_Date(LCD_Display_Box2Password_i[i]);

voidDisplay_Input_Box3()//box3passwordinput

Write_Bit_Date(LCD_Display_Box3Password_i[i]);

voidDisplay_Input_Box4()//box4passwordinput

Write_Bit_Date(LCD_Display_Box4Password_i[i]);

}

voidDisplay_GetPassw()//获取密码显示界面

Write_Bit_Date(LCD_Display_GetPassw_i[i]);

LCD_Display_i[5]=0x30+Show_P_f;

LCD_Display_i[6]=0x30+Show_P_e;

LCD_Display_i[7]=0x30+Show_P_d;

LCD_Display_i[8]=0x30+Show_P_c;

LCD_Display_i[9]=0x30+Show_P_b;

LCD_Display_i[10]=0x30+Show_P_a;

delay(60000);

//密码显示时间,延时6ms*3

Interface=0;

//返回常态界面

voidDisplay_BoxFull()//满箱显示

Write_Bit_Date(LCD_Display_Full_i[i]);

Write_Bit_Date(LCD_Display_Full_j[j]);

//返回常态界面

|键盘扫描子函数|

voidKey_Scanf()//temp_a的量表示键值,默认为0,键值移位后才改变

a=1,b=1,c=1,d=0;

x=1,y=1,z=1;

if(z==0){delay(200);

if(z==0){while(z==0);

{if(Box1==0){Box1=1;

Interface=1;

Passw_Box1_a=Num%10;

Passw_Box1_b=Num/10%10;

delay

(1);

Passw_Box1_c=Num%10;

delay

(2);

Passw_Box1_d=Num/100%10;

delay(4);

Passw_Box1_e=Num%10;

delay(6);

Passw_Box1_f=Num/10%10;

Show_P_a=Passw_Box1_a;

Show_P_b=Passw_Box1_b;

Show_P_c=Passw_Box1_c;

Show_P_d=Passw_Box1_d;

Show_P_e=Passw_Box1_e;

Show_P_f=Passw_Box1_f;

}//若Box1空,则弹出继电器;

定时器取值做为密码,显示获取密码界面

elseif(Box2==0){Box2=1;

Passw_Box2_a=Num%10;

Passw_Box2_b=Num/10%10;

delay(3);

Passw_Box2_c=Num%10;

Passw_Box2_d=Num/100%10;

Passw_Box2_e=Num%10;

delay(5);

Passw_Box2_f=Num/10%10;

Show_P_a=Passw_Box2_a;

Show_P_b=Passw_Box2_b;

Show_P_c=Passw_Box2_c;

Show_P_d=Passw_Box2_d;

Show_P_e=Passw_Box2_e;

Show_P_f=Passw_Box2_f;

}//若Box2空,则弹出继电器

elseif(Box3==0){Box3=1;

Passw_Box3_a=Num%10;

Passw_Box3_b=Num/10%10;

delay(7);

Passw_Box3_c=Num%10;

Passw_Box3_d=Num/100%10;

Passw_Box3_e=Num%10;

Passw_Box3_f=Num/10%10;

Show_P_a=Passw_Box3_a;

Show_P_b=Passw_Box3_b;

Show_P_c=Passw_Box3_c;

Show_P_d=Passw_Box3_d;

Show_P_e=Passw_Box3_e;

Show_P_f=Passw_Box3_f;

}//若Box3空,则弹出继电器

elseif(Box4==0){Box4=1;

Passw_Box4_a=Num%10;

Passw_Box4_b=Num/10%10;

Passw_B

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 自然科学 > 物理

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2