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

📄 slrc632.lst

📁 读ISO14443 CPU卡源代码
💻 LST
📖 第 1 页 / 共 3 页
字号:
C51 COMPILER V8.05a   SLRC632                                                              07/05/2010 23:34:44 PAGE 1   


C51 COMPILER V8.05a, COMPILATION OF MODULE SLRC632
OBJECT MODULE PLACED IN SlRc632.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE SlRc632.C ROM(COMPACT) BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include "reg52.h"
   2          #include <intrins.h>
   3          #include <string.h>
   4          #include "main.h"
   5          #include <absacc.h>
   6          #include "slrc632.h"
   7          
   8          #define FSD 64
   9          #define Gpbase                0x7F00                    //感应模块地址          P2^7
  10          #define outportb(addr,d)        XBYTE[addr]=d                    //写入addr地址值D      /               绝对地址
  11          #define inportb(addr)           XBYTE[addr]                       ///读出addr地址值
  12          extern struct TranSciveBuffer{unsigned char MfCommand;
  13                                        unsigned int  MfLength;
  14                                        unsigned char MfData[64];
  15                                       };
  16          
  17          
  18          
  19          
  20          
  21          
  22          
  23          unsigned char ReadRawRC(unsigned char Address)
  24          {
  25   1              return inportb(Gpbase+Address);            }
  26          
  27          
  28          void  WriteRawRC(unsigned char Address, unsigned char value)
  29          {  
  30   1              outportb(Gpbase+Address,value);
  31   1      }
  32          
  33          
  34          
  35          
  36          
  37          
  38          /////////////////////////////////////////////////////////////////////
  39          //复位并初始化RC632
  40          //注意:RC500上电后应延时500ms才能可靠初始化
  41          /////////////////////////////////////////////////////////////////////
  42          char PcdReset()
  43          {
  44   1         char status = MI_OK;
  45   1         char n = 0xFF;
  46   1         unsigned int i = 3000;
  47   1      
  48   1         RC632_CE=0;
  49   1         RC632_RST=0;
  50   1         DelayMs(50);
  51   1         RC632_RST=1;
  52   1         DelayMs(5);
  53   1         RC632_RST=0;
  54   1         DelayMs(5);
  55   1      
C51 COMPILER V8.05a   SLRC632                                                              07/05/2010 23:34:44 PAGE 2   

  56   1         while (i!=0 && n)
  57   1         {
  58   2            n = ReadRawRC(RegCommand);
  59   2            i--;
  60   2         }
  61   1      
  62   1         if (i != 0)
  63   1         {
  64   2            WriteRawRC(RegPage,0x80);
  65   2            n = 0x80;
  66   2            while ( (i!=0) && (n&0x80) )
  67   2            {
  68   3                n = ReadRawRC(RegCommand);
  69   3                i--;
  70   3            }
  71   2            if (i==0 || (n&0xFF))
  72   2            {   status = MI_RESETERR;   }
  73   2         }
  74   1         else
  75   1         {    status = MI_RESETERR;     }
  76   1         
  77   1         if (status == MI_OK)
  78   1         {    WriteRawRC(RegPage,0x0);  }
  79   1         
  80   1         return status;
  81   1      }
  82          
  83          //////////////////////////////////////////////////////////////////////
  84          //设置RC632的工作方式 
  85          //////////////////////////////////////////////////////////////////////
  86          char PcdConfigISOType(unsigned char type)
  87          {
  88   1         
  89   1         if (type == 'A')                    //ISO14443_A
  90   1         { 
  91   2             ClearBitMask(RegControl,0x08);
  92   2      
  93   2             WriteRawRC(RegClockQControl,0x0);
  94   2             WriteRawRC(RegClockQControl,0x40);
  95   2             Delay_50us(2);                   // wait approximately 100 us - calibration in progress
  96   2             ClearBitMask(RegClockQControl,0x40);
  97   2             
  98   2             WriteRawRC(RegTxControl,0x5b);
  99   2             WriteRawRC(RegCwConductance,0x0F);
 100   2             WriteRawRC(RegModConductance,0x3F);       
 101   2             WriteRawRC(RegCoderControl,0x19);
 102   2             WriteRawRC(RegModWidth,0x13);             
 103   2             WriteRawRC(RegModWidthSOF,0x00);          
 104   2             WriteRawRC(RegTypeBFraming,0x00);
 105   2             
 106   2             WriteRawRC(RegRxControl1,0x73);
 107   2             WriteRawRC(RegDecoderControl,0x08);
 108   2             WriteRawRC(RegBitPhase,0xAD);    
 109   2             WriteRawRC(RegRxThreshold,0xAA);
 110   2             WriteRawRC(RegBPSKDemControl,0);
 111   2             WriteRawRC(RegRxControl2,0x41);
 112   2      
 113   2             WriteRawRC(RegRxWait,0x06);
 114   2             WriteRawRC(RegChannelRedundancy,0x0F);    
 115   2             WriteRawRC(RegCRCPresetLSB,0x63);
 116   2             WriteRawRC(RegCRCPresetMSB,0x63);
 117   2             WriteRawRC(RegTimeSlotPeriod,0x00);
C51 COMPILER V8.05a   SLRC632                                                              07/05/2010 23:34:44 PAGE 3   

 118   2             WriteRawRC(RegMfOutSelect,0x00);
 119   2             WriteRawRC(RFU27,0x00);                
 120   2      
 121   2             WriteRawRC(RegFIFOLevel,0x3F);
 122   2             WriteRawRC(RegTimerClock,0x07);
 123   2             WriteRawRC(RegTimerReload,0x0A);
 124   2             WriteRawRC(RegTimerControl,0x06);   
 125   2             WriteRawRC(RegIRqPinConfig,0x02);      
 126   2             WriteRawRC(RFU2E,0x00);
 127   2             WriteRawRC(RFU2F,0x00);    
 128   2      
 129   2             PcdSetTmo(106);
 130   2             DelayMs(1);
 131   2             PcdAntennaOn();
 132   2      
 133   2         }
 134   1         else if (type == 'B')
 135   1         {
 136   2             ClearBitMask(RegControl,0x08);
 137   2      
 138   2             WriteRawRC(RegClockQControl,0x0);
 139   2             WriteRawRC(RegClockQControl,0x40);
 140   2             Delay_50us(2);  
 141   2             ClearBitMask(RegClockQControl,0x40);
 142   2             
 143   2             WriteRawRC(RegTxControl,0x4B);
 144   2             WriteRawRC(RegCwConductance,0x17);
 145   2             WriteRawRC(RegModConductance,0x06);       
 146   2             WriteRawRC(RegCoderControl,0x20);
 147   2             WriteRawRC(RegModWidth,0x13);             
 148   2             WriteRawRC(RegModWidthSOF,0x3F);          
 149   2             WriteRawRC(RegTypeBFraming,0x3B);
 150   2             
 151   2             WriteRawRC(RegRxControl1,0x73);
 152   2             WriteRawRC(RegDecoderControl,0x19);
 153   2             WriteRawRC(RegBitPhase,0xAD);    
 154   2             WriteRawRC(RegRxThreshold,0x88);
 155   2             WriteRawRC(RegBPSKDemControl,0x7E);
 156   2             WriteRawRC(RegRxControl2,0x01);
 157   2      
 158   2             WriteRawRC(RegRxWait,0x06);
 159   2             WriteRawRC(RegChannelRedundancy,0x2C);    
 160   2             WriteRawRC(RegCRCPresetLSB,0xFF);
 161   2             WriteRawRC(RegCRCPresetMSB,0xFF);
 162   2             WriteRawRC(RegTimeSlotPeriod,0x00);
 163   2             WriteRawRC(RegMfOutSelect,0x00);
 164   2             WriteRawRC(RFU27,0x00);                
 165   2      
 166   2             WriteRawRC(RegFIFOLevel,0x3F);
 167   2             WriteRawRC(RegTimerClock,0x07);
 168   2             WriteRawRC(RegTimerReload,0x0A);
 169   2             WriteRawRC(RegTimerControl,0x06);  
 170   2             WriteRawRC(RegIRqPinConfig,0x02);       
 171   2             WriteRawRC(RFU2E,0x00);
 172   2             WriteRawRC(RFU2F,0x00);
 173   2             PcdSetTmo(106);
 174   2             DelayMs(1);
 175   2             PcdAntennaOn();
 176   2         }
 177   1         else if (type == 'r')
 178   1         {
 179   2             ClearBitMask(RegControl,0x08);
C51 COMPILER V8.05a   SLRC632                                                              07/05/2010 23:34:44 PAGE 4   

 180   2      
 181   2             WriteRawRC(RegClockQControl,0x0);
 182   2             WriteRawRC(RegClockQControl,0x40);
 183   2             Delay_50us(2); 
 184   2             ClearBitMask(RegClockQControl,0x40);
 185   2             
 186   2             WriteRawRC(RegTxControl,0x4b);//8);//?0x4b
 187   2             WriteRawRC(RegCwConductance,0x06);
 188   2             WriteRawRC(RegModConductance,0x03);       
 189   2             WriteRawRC(RegCoderControl,0x20);
 190   2             WriteRawRC(RegModWidth,0x13);             
 191   2             WriteRawRC(RegModWidthSOF,0x00);          
 192   2             WriteRawRC(RegTypeBFraming,0x3B);
 193   2             
 194   2             WriteRawRC(RegRxControl1,0x73);
 195   2             WriteRawRC(RegDecoderControl,0x19);
 196   2             WriteRawRC(RegBitPhase,0xAD);    
 197   2             WriteRawRC(RegRxThreshold,0x88);
 198   2             WriteRawRC(RegBPSKDemControl,0x3E);
 199   2             WriteRawRC(RegRxControl2,0x01);
 200   2      
 201   2             WriteRawRC(RegRxWait,0x06);
 202   2             WriteRawRC(RegChannelRedundancy,0x2C);    
 203   2             WriteRawRC(RegCRCPresetLSB,0xFF);
 204   2             WriteRawRC(RegCRCPresetMSB,0xFF);
 205   2             WriteRawRC(RegTimeSlotPeriod,0x00);
 206   2             WriteRawRC(RegMfOutSelect,0x00);
 207   2             WriteRawRC(RFU27,0x00);                
 208   2      
 209   2             WriteRawRC(RegFIFOLevel,0x1A);
 210   2             WriteRawRC(RegTimerClock,0x07);
 211   2             WriteRawRC(RegTimerReload,0x0A);
 212   2             WriteRawRC(RegTimerControl,0x06);  
 213   2             WriteRawRC(RegIRqPinConfig,0x02);       
 214   2             WriteRawRC(RFU2E,0x00);
 215   2             WriteRawRC(RFU2F,0x00);   
 216   2             PcdSetTmo(106);

⌨️ 快捷键说明

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