电子密码锁发展及设计 第4页

电子密码锁发展及设计 第4页
3.4 C语言源程序 
#include <reg51.h> ;初始化        
#include<intrins.h>
#define uchar unsingned char
#define uint unsingned int

#define shut_()P1|=0xf8;
#dedine RCtrl  0x10
#define RConti  0xfe

#define N2
#define MaxRate 50
#define MinRate 20
#define leddark  83
#define ledshow 83
#define define decimal  0x7f

void main(void)       ;键值处理(密码识别)
{
Uchar i ,scan=0xfe;
Shut_dis()
For(i=1;i<=8;i++)
{  
Send_shift(scan(;
If(! Key_sl)
{
    If(~scan&RCtrl)
    {  
        kpd- >shiftcnt++;
        kpd- >shiftval=I;
}
else
{
    Kpd- >funcnt++
    Kpd - >funval=I;
          }
               }
               Scan=_crol_(scan,1);
          }
 }
                      funcount++;
                      if(funcount==pslen+2)
                        {
        {
          second3=0;
          hibitflag=0;
          errorflag=1;
                 
     P2=dispcode[digitcount];
                   
          cmpflag=0;
  if(funcount==1)
                    
   {
      pslen=digitcount;
    templen=pslen;
     else if(funcount>1)                  
          alarmflag=0;
          bb=0;
          aa=0;
        }
    }

  if((errorflag==0) && (rightflag==1))
    {
      P0_1=0;
      cc++;
      if(cc<1000)
        {
          okflag=1;
        }
www.751com.cn
cc=0;
              oka=0;
              okb=0;
              okflag=0;
              P0_0=1;
            }   if(P3_7==0) //digit key
            {
              for(i=10;i>0;i--)                
 funcount=0;
                  cmpflag=1;
                         }
                       P1=dispcode[funcount];
                    }
                    els                                                                   void dfg (void)        ; 指示驱动、密码修改

         {
              cmpflag=0;
  second3=0;
                      }
                  while(P3_6==0);

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

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有