单片机课程设计密码程序和仿真图.docVIP

  • 7
  • 0
  • 约6.41千字
  • 约 10页
  • 2016-08-17 发布于贵州
  • 举报
单片机课程设计密码程序和仿真图

#includeat89x51.h #define uchar unsigned char #define uint unsigned int uint num=10; //开始让数码管什么都不显示 bit set=0; //定义设置密码的位 char count=-1; //开始让COUNT=-1,方便后面显示数码管 sbit Beep=P1^2; //蜂鸣器 uchar temp; uchar pws[6]={3,6,2,3,3,0}; //原始密码 uchar pwx[6]; //按下的数字存储区 bit rightflag; //密码正确标志位 uchar workbuf[6]; uchar code tabledu[]={ 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00,0x40 }; //段选码,共阴极 uchar code tablewe[]={ 0xfe,0xfd,0xfb,0xf7,0xef,0xdf }; //位选码 uint keyscan(); void delay(uchar z) //延时,ms级 { uchar y; for(;z0;z--) for(y=120;y0;y--); } void setpw() //设置密码函数 { keyscan(); }

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档