⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 user.lst

📁 指纹识别源代码,用于智能门紧,还有配合MF800卡使用
💻 LST
📖 第 1 页 / 共 4 页
字号:
C51 COMPILER V7.01  USER                                                                   03/08/2007 12:09:39 PAGE 1   


C51 COMPILER V7.01, COMPILATION OF MODULE USER
OBJECT MODULE PLACED IN user.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE user.c OPTIMIZE(7,SPEED) REGFILE(.\fingerPRJ.ORC) BROWSE FLOATFUZZY(0) NOAR
                    -EGS DEBUG OBJECTEXTEND CODE

stmt level    source

   1          #include "reg58.h"
   2          #include "intrins.h"
   3          
   4          #define _USER_C_
   5          #include "user.h"
   6          
   7          #include "define.h"
   8          #include "sram.h"
   9          #include "finger.h"
  10          #include "system.h"
  11          #include "setup.h"
  12          #include "rxd.h"
  13          #include "keypad.h"
  14          /////////////////////////////////////////////////////////////////////////////////
  15          void readuserdata(unsigned short usersn)
  16          {
  17   1              usersn+=PAGEUSERSTART*32;
  18   1              ram_read8(usersn,usersn>>8);
  19   1      }
  20          /////////////////////////////////////////////////////////////////////////////////
  21          void writeuserdata(unsigned short usersn)
  22          {
  23   1              usersn+=PAGEUSERSTART*32;
  24   1              ram_write8(usersn,usersn>>8);
  25   1      
  26   1      }
  27          /////////////////////////////////////////////////////////////////////////////////
  28          bit testemptysn(unsigned short index)
  29          {
  30   1              //ram_read8((unsigned char)index,(unsigned char)(index>>8));
  31   1              readuserdata(index);
  32   1              if((tempbuff[8]>0xa0)||(tempbuff[9]>=0xa0))
  33   1                      return TRUE;                    //not used
  34   1              else return FALSE;                      //used
  35   1      }
  36          /////////////////////////////////////////////////////////////////////////////////
  37          bit getemptysn(unsigned char direction)
  38          {
  39   1              unsigned short tempsn;
  40   1      
  41   1              if(direction==DOWNWARD)
  42   1              {
  43   2                      if(currentsn>=MAXUSERNUM)tempsn=0;
  44   2                      else tempsn=currentsn+1;
  45   2                      for(;tempsn<MAXUSERNUM;tempsn++)
  46   2                      {
  47   3                              if(testemptysn(tempsn))break;
  48   3                      }
  49   2                      if(tempsn>=MAXUSERNUM)return FALSE;
  50   2              }
  51   1              else
  52   1              {
  53   2                      if(currentsn>=MAXUSERNUM)tempsn=MAXUSERNUM-1;
  54   2                      else tempsn=currentsn-1;
C51 COMPILER V7.01  USER                                                                   03/08/2007 12:09:39 PAGE 2   

  55   2                      for(;tempsn<MAXUSERNUM;tempsn--)
  56   2                      {
  57   3                              if(testemptysn(tempsn))break;
  58   3                      }
  59   2                      if(tempsn>=MAXUSERNUM)return FALSE;
  60   2              }
  61   1              currentsn=tempsn;
  62   1              return TRUE;
  63   1      }
  64          /////////////////////////////////////////////////////////////////////////////////
  65          bit getusedsn(unsigned char direction)
  66          {
  67   1              unsigned short tempsn;
  68   1      
  69   1              if(direction==DOWNWARD)
  70   1              {
  71   2                      if(currentsn==MAXUSERNUM)return FALSE;
  72   2      
  73   2                      if(currentsn>MAXUSERNUM)tempsn=0;
  74   2                      else tempsn=currentsn+1;
  75   2                      for(;tempsn<MAXUSERNUM;tempsn++)
  76   2                      {
  77   3                              if(!testemptysn(tempsn))break;
  78   3                      }
  79   2                      if(tempsn>=MAXUSERNUM)return FALSE;
  80   2              }
  81   1              else
  82   1              {
  83   2                      if(currentsn==0)return FALSE;
  84   2                      if(currentsn>=MAXUSERNUM)tempsn=MAXUSERNUM-1;
  85   2                      else tempsn=currentsn-1;
  86   2                      for(;tempsn<MAXUSERNUM;tempsn--)
  87   2                      {
  88   3                              if(!testemptysn(tempsn))break;
  89   3                      }
  90   2                      if(tempsn>=MAXUSERNUM)return FALSE;
  91   2              }
  92   1              currentsn=tempsn;
  93   1              return TRUE;
  94   1      }
  95          /////////////////////////////////////////////////////////////////////////////////
  96          bit adduser()
  97          {
  98   1              //unsigned char i;
  99   1              currentsn=0XFFFF;
 100   1              if(!getemptysn(DOWNWARD))
 101   1                      return FALSE;
 102   1      
 103   1              //ram_write8((unsigned char)currentsn,(unsigned char)(currentsn>>8));
 104   1              writeuserdata(currentsn);
 105   1      
 106   1              return TRUE;
 107   1      }
 108          /////////////////////////////////////////////////////////////////////////////////
 109          bit getuserbytempid()
 110          {
 111   1              currentsn=0xffff;
 112   1              while(getusedsn(DOWNWARD))
 113   1              {
 114   2                      if(tempbuff[8]!=tempbuff[0])continue;
 115   2                      if(tempbuff[9]!=tempbuff[1])continue;
 116   2                      if(tempbuff[10]!=tempbuff[2])continue;
C51 COMPILER V7.01  USER                                                                   03/08/2007 12:09:39 PAGE 3   

 117   2                      if(tempbuff[11]!=tempbuff[3])continue;
 118   2      
 119   2                      return TRUE;
 120   2              }
 121   1              return FALSE;
 122   1      }
 123          /////////////////////////////////////////////////////////////////////////////////
 124          bit getuserbyid()
 125          {
 126   1              //unsigned short tempsn;
 127   1              currentsn=0xffff;
 128   1              while(getusedsn(DOWNWARD))
 129   1              {
 130   2                      if(tempbuff[8]!=userid[0])continue;
 131   2                      if(tempbuff[9]!=userid[1])continue;
 132   2                      if(tempbuff[10]!=userid[2])continue;
 133   2                      if(tempbuff[11]!=userid[3])continue;
 134   2      
 135   2                      return TRUE;
 136   2              }
 137   1              return FALSE;
 138   1      }
 139          ////////////////////////////////////////////////////////////////////////////////
 140          //delete the user who's id is userid[4]
 141          bit deleteuserbyid()
 142          {
 143   1              unsigned char i;
 144   1      
 145   1              if(getuserbyid())
 146   1              {
 147   2                      if(tempbuff[15]&0xf)
 148   2                      {
 149   3                              rdeleteuserbysn();
 150   3                      }
 151   2                      for(i=0;i<8;i++)tempbuff[i]=0xff;
 152   2                      //ram_write8((unsigned char)currentsn,(unsigned char)(currentsn>>8));                   
 153   2                      writeuserdata(currentsn);
 154   2                      return TRUE;
 155   2              }
 156   1              else
 157   1              {
 158   2                      return FALSE;
 159   2              }
 160   1      }
 161          /////////////////////////////////////////////////////////////////////////////////
 162          void deleteuserbysn()
 163          {
 164   1              unsigned char i =0;
 165   1              for(i=0;i<8;i++)tempbuff[i]=0xff;
 166   1      
 167   1              writeuserdata(currentsn);
 168   1      }
 169          /////////////////////////////////////////////////////////////////////////////////
 170          unsigned short getusernum()
 171          {
 172   1              unsigned short usernum=0;
 173   1              currentsn=0XFFFF;
 174   1              while(getusedsn(DOWNWARD))usernum++;
 175   1      
 176   1              return usernum;
 177   1              //return FALSE;
 178   1      }
C51 COMPILER V7.01  USER                                                                   03/08/2007 12:09:39 PAGE 4   

 179          /////////////////////////////////////////////////////////////////////////////////
 180          bit getnewuser()
 181          {
 182   1              currentsn=0;
 183   1              while(getusedsn(DOWNWARD))
 184   1              {
 185   2                      
 186   2                      if(tempbuff[14]&0xf0)return TRUE;
 187   2              }
 188   1              return FALSE;
 189   1      }
 190          /////////////////////////////////////////////////////////////////////////////////
 191          void changenewuser()
 192          {
 193   1              //ram_read8(currentsn,currentsn>>8);
 194   1              readuserdata(currentsn);
 195   1              tempbuff[14]&=0xf;
 196   1      
 197   1              idata2idata(tempbuff+8,tempbuff,8);
 198   1              //ram_write8(currentsn,currentsn>>8);
 199   1              writeuserdata(currentsn);
 200   1      }
 201          /////////////////////////////////////////////////////////////////////////////////
 202          void deletealluser()
 203          {
 204   1              unsigned char i =0;
 205   1              for(i=0;i<8;i++)tempbuff[i]=0xff;
 206   1      
 207   1              for(currentsn=0;currentsn<MAXUSERNUM+30;currentsn++)
 208   1              {
 209   2                      //ram_write8(currentsn,currentsn>>8);
 210   2                      writeuserdata(currentsn);
 211   2              }
 212   1      }
 213          /////////////////////////////////////////////////////////////////////////////////
 214          void userclear()
 215          {
 216   1              //unsigned short i;
 217   1              currentsn=0xffff;
 218   1              
 219   1              while(getusedsn(DOWNWARD))
 220   1              {
 221   2                      deleteuserbysn();
 222   2                      rdeleteuserbysn();
 223   2              }
 224   1      }
 225          //////////////////////////////////////////////////////////////
 226          /////////////////////////////////////////////////////////////////////////////////
 227          /////////////////////////////////////////////////////////////////////////////////
 228          /////////////////////////////////////////////////////////////////////////////////
 229          /////////////////////////////////////////////////////////////////////////////////
 230          /////////////////////////////////////////////////////////////////////////////////
 231          /////////////////////////////////////////////////////////////////////////////////
 232          /*bit  adduser(struct userdata * puser)
 233          {
 234                  currentsn=0;
 235                  if(getemptysn(DOWNWARD))
 236                  {
 237                          
 238                          buffcopy(tempbuff,(unsigned char*)puser,8);
 239                          ram_write8(currentsn,tempbuff);
 240          
C51 COMPILER V7.01  USER                                                                   03/08/2007 12:09:39 PAGE 5   

 241                          if(rgetuser(currentsn,0))
 242                          {
 243                                  if(!rdeleteuser(userid))
 244                                          return FALSE;
 245                          }
 246                          
 247                          if(radduser(ADDUSERNOFINGER))
 248                          {
 249                                  return TRUE;
 250                          }
 251                          else return FALSE;
 252                  }
 253                  else return FALSE;
 254          }*/
 255          ///////////////////////////////////////////////////////////////////////////////////
 256          //bit getusedsn(unsigned char aaa)
 257          //{
 258          //      return TRUE;
 259          //}
 260          
 261          ///////////////////////////////////////////////////////////////////////////////////
 262          ///////////////////////////////////////////////////////////////////////////////////
 263          ///////////////////////////////////////////////////////////////////////////////////
 264          //////??????????/////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -