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

📄 main.lst

📁 ZLG500A读卡模块使用指南、函数库及示范程序
💻 LST
字号:
C51 COMPILER V7.50   MAIN                                                                  04/23/2009 15:22:21 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #define __SRC
   2                  #include "main.h"
   3          #undef  __SRC
   4          
   5          #include "zlg500.h"
   6          
   7          #define MF1_S50         0
   8          #define MF1_S70         1
   9          #define MF0_ULIGHT      2
  10          #define MF1_LIGHT       3
  11          
  12          sbit zlg500_RST=P1^4;
  13          
  14          uchar code Nkey_a[6]    = {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5};
  15          uchar code Nkey_b[6]    = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
  16          uchar idata cfg1[16] = {0x00,0x58,0x3f,0x3f,0x19,0x13,0x00,0x00,0x00,0x73,0x08,0xad,0xff,0x00,0x41,0x00};
  17          uchar idata cfg2[16] = {0x00,0x06,0x03,0x63,0x63,0x00,0x00,0x00,0x00,0x08,0x07,0x06,0x0a,0x02,0x00,0x00};
  18          
  19          main()
  20          {       
  21   1              uchar cardtype = MF1_S50;
  22   1              uchar idata card_snr[8];
  23   1              uchar idata databuf[16];
  24   1              long idata value=1;
  25   1              uchar i,j;
  26   1              
  27   1              zlg500_RST=1;
  28   1              for(i=255;i>0;i--)
  29   1                      for(j=255;j>0;j--);
  30   1              zlg500_RST=0;
  31   1              for(i=255;i>0;i--)
  32   1                      for(j=255;j>0;j--);     
  33   1              spi_init();     
  34   1              EA=1;   
  35   1      
  36   1              i=mifs_config();
  37   1      
  38   1              i=mifs_get_info(databuf);
  39   1              i=mifs_clr_control_bit();       
  40   1              i=mifs_set_control_bit();
  41   1              i=mifs_read_E2(0x10,16,databuf);
  42   1              databuf[0]=0x01;
  43   1      //      i=mifs_write_E2(0x10,16,cfg1);
  44   1      //      i=mifs_write_E2(0x20,16,cfg2);
  45   1              mifs_load_key(KEYA,5,Nkey_b);
  46   1      //      i=mifs_write_reg(0x11,0x59);
  47   1      //      i=mifs_write_reg(0x12,1);
  48   1              
  49   1              while(1)
  50   1              {       
  51   2                      while(mifs_request(IDLE,databuf)!=MI_OK);
  52   2                      if(mifs_cascanticoll(ANTICOLL1,0,card_snr)!=MI_OK)      continue;       
  53   2                      if(mifs_cascselect(ANTICOLL1,card_snr,&i)!=MI_OK)       continue;
  54   2                      if(i&0x04)
  55   2                      {
C51 COMPILER V7.50   MAIN                                                                  04/23/2009 15:22:21 PAGE 2   

  56   3                              if(mifs_cascanticoll(ANTICOLL2,0,card_snr+4)!=MI_OK)    continue;       
  57   3                              if(mifs_cascselect(ANTICOLL2,card_snr+4,&i)!=MI_OK)     continue;
  58   3                      }
  59   2      
  60   2                      if(cardtype == MF1_S50)
  61   2                      {
  62   3                              if(mifs_authentication(KEYA,5)!=0)                      continue;
  63   3                              databuf[0]=0x10;
  64   3                              databuf[4]=~0x10;
  65   3                              databuf[8]=0x10;
  66   3                              for(i=1;i<4;i++)
  67   3                              {
  68   4                                      databuf[i]=0x00;
  69   4                                      databuf[4+i]=0xff;
  70   4                                      databuf[8+i]=0x00;
  71   4                              }
  72   3                              databuf[12]=0x14;
  73   3                              databuf[13]=~0x14;
  74   3                              databuf[14]=0x14;
  75   3                              databuf[15]=~0x14;
  76   3                              if(mifs_write(0x14,databuf)!=0) continue;
  77   3                              databuf[0]=0;
  78   3                              if(mifs_read(0x14,databuf)!=0)  continue;
  79   3                              value=1;
  80   3                              if(mifs_value(PICC_DECREMENT,0x14,&value,0x15)!=0)      continue;
  81   3                              if(mifs_read(0x15,databuf)!=0)  continue;
  82   3                              if(mifs_value(PICC_INCREMENT,0x14,&value,0x16)!=0)      continue;
  83   3                              if(mifs_read(0x16,databuf)!=0)  continue;
  84   3                      }
  85   2                      else if(cardtype == MF1_S70)
  86   2                      {
  87   3                              if(mifs_authentication2(KEYA,39,5)!=0)  continue;
  88   3                              if(mifs_read(240,databuf)!=0)   continue;
  89   3                      }
  90   2                      else if(cardtype == MF0_ULIGHT)
  91   2                      {
  92   3                              databuf[0]=0x11;
  93   3                              databuf[1]=0x22;
  94   3                              databuf[2]=0x33;
  95   3                              databuf[3]=0x44;
  96   3                              if(mifs_ULwrite(15,databuf)!=0) continue;
  97   3                              databuf[0]=0x00;
  98   3                              databuf[1]=0x00;
  99   3                              databuf[2]=0x00;
 100   3                              databuf[3]=0x00;
 101   3                              if(mifs_read(15,databuf)!=0)    continue;
 102   3                      }
 103   2                      else if(cardtype == MF1_LIGHT)
 104   2                      {
 105   3                              if(mifs_authKey(KEYA,2,Nkey_b)!=0)      continue;
 106   3                              databuf[0]=0x10;
 107   3                              databuf[1]=0x00;
 108   3                              databuf[2]=0xef;
 109   3                              databuf[3]=0xff;
 110   3                              if(mifs_write(4,databuf)!=0)    continue;
 111   3                              databuf[0]=0xff;
 112   3                              databuf[1]=0xff;
 113   3                              databuf[2]=0xff;
 114   3                              databuf[3]=0xff;
 115   3                              if(mifs_write(5,databuf)!=0)    continue;
 116   3                              if(mifs_read(4,databuf)!=0)             continue;
 117   3                              if(databuf[0]!=~databuf[2] || databuf[1]!=~databuf[3])
C51 COMPILER V7.50   MAIN                                                                  04/23/2009 15:22:21 PAGE 3   

 118   3                                      continue;
 119   3                              value=1;
 120   3                              if(mifs_valuedebit(0xc0,4,&value)!=0)   continue;
 121   3                              if(mifs_read(4,databuf)!=0)             continue;
 122   3                      }
 123   2      
 124   2                      mifs_halt();
 125   2      //              mifs_reset(1);
 126   2                      
 127   2              //      i=mifs_write_E2(0x30,16,databuf);
 128   2              //      if(i!=0)        continue;
 129   2                      mifs_clr_control_bit();
 130   2                      mifs_buzzer(250,20);
 131   2                      while(mifs_set_control_bit()!=0);
 132   2              }
 133   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    638    ----
   CONSTANT SIZE    =     12    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----       3
   IDATA SIZE       =     32      28
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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