毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 论文 >> 正文

电子密码锁电路图及设计 第4页

更新时间:2010-1-31:  来源:毕业论文
电子密码锁电路图及设计 第4页
C语言源程序
#i nclude
unsigned char code ps[]={1,1,1,1,1};
unsigned char code dispcode[]={0x3f,0x06,0x5b,0x4f,0x66,
                               0x6d,0x7d,0x07,0x7f,0x6f,0x00,0x40};
unsigned char pslen=9;
unsigned char templen;
unsigned char digit;
unsigned char funcount;
unsigned char digitcount;
unsigned char psbuf[9];
bit cmpflag;
bit hibitflag;
bit errorflag;
bit rightflag;
unsigned int second3;
unsigned int aa;
unsigned int bb;
bit alarmflag;
bit exchangeflag;
unsigned int cc;
unsigned int dd;
bit okflag;
unsigned char oka;
unsigned char okb;
void main(void)
{
  unsigned char i,j;
  P2=dispcode[digitcount];
  TMOD=0x01;
  TH0=(65536-500)/256;
  TL0=(65536-500)%6;
  TR0=1;
  ET0=1;
  EA=1;
  while(1)
    {
      if(cmpflag==0)
        {
          if(P3_6==0) //function key
            { 
www.751com.cn
              if(P3_6==0)
                {
                  if(hibitflag==0)
                    {
                      funcount++;
                      if(funcount==pslen+2)
                        {
                          funcount=0;
                          cmpflag=1;
                         }
                       P1=dispcode[funcount];
                    }
                    else
                      {
                         second3=0;
                      }
                  while(P3_6==0);
                }
            }
          if(P3_7==0) //digit key
            {
              for(i=10;i>0;i--)
              for(j=248;j>0;j--);
              if(P3_7==0)
                {
                  if(hibitflag==0)
                    {
                      digitcount++;                     
                      if(digitcount==10)
                        {
                          digitcount=0;
                        }
                      P2=dispcode[digitcount];
                      if(funcount==1)
                        {
                          pslen=digitcount;
                          templen=pslen;
                        }
                        else if(funcount>1)
                          {
                            psbuf[funcount-2]=digitcount;
                          }
                    }
                    else
                      {
                        second3=0;
                      }
                  while(P3_7==0);
                }
            }
        }
        else
          {
            cmpflag=0;
            for(i=0;i
              {
                if(ps[i]!=psbuf[i])
                  {
                    hibitflag=1;
                    i=pslen;
                    errorflag=1;
                    rightflag=0;
                    cmpflag=0;
                    second3=0;
                    goto a;
                  }
              }
            cc=0;
            errorflag=0;
            rightflag=1;
            hibitflag=0;
a:          cmpflag=0;
          }
    }
}
void t0(void) interrupt 1 using 0
{
  TH0=(65536-500)/256;
  TL0=(65536-500)%6;
  if((errorflag==1) && (rightflag==0))
    {
      bb++;
      if(bb==800)
        {
          bb=0;
          alarmflag=~alarmflag;
        }
      if(alarmflag==1)
        {
          P0_0=~P0_0;
        }
      aa++;
      if(aa==800)         {

上一页  [1] [2] [3] [4] [5] 下一页

电子密码锁电路图及设计 第4页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。