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

📄 readermodule.lst

📁 Use this program to decode the Manchester Code of the RFID. Validate the accessibility of detected c
💻 LST
📖 第 1 页 / 共 5 页
字号:
 204          /******************************************************************************
 205          Interrupt 1, INT1-not using here
 206          *******************************************************************************/
 207          void ex1_isr (void) interrupt 2
 208          {
 209   1                                                      
 210   1      }
 211          
 212          /***********************************************************************************
 213          Timer 2 overflow interrupt at 0.039s
 214          byte start from 4, as the cardbytein contain start byte 
 215          
 216          **********************************************************************************/
 217          unsigned char xorbit;
 218          void timer2_overflow(void) interrupt 5                                                                                  
 219          {
 220   1              TF2 = 0;            /* Clear the interrupt request */
 221   1              
 222   1              secdly++;               
 223   1              if(++ledcount0>=40)     //35
 224   1              {
 225   2                      ledcount0=0;
 226   2                      LED0^=1;
 227   2                      if(Flags.DoorOpen)
 228   2                      {
 229   3                              xorbit^=1;
 230   3                              if(xorbit)
 231   3                                      BUZZER=1;
 232   3                              else
C51 COMPILER V7.06   READERMODULE                                                          09/05/2006 01:45:27 PAGE 5   

 233   3                                      BUZZER=0;
 234   3                                      
 235   3                              //BUZZER^=1;
 236   3                              put_c('X');
 237   3                      }
 238   2              }
 239   1              
 240   1              
 241   1              cardtime++;
 242   1              /*
 243   1              if(cardtime++ >CARDTIMELIMIT )  
 244   1                      cardtime=CARDTIMELIMIT; //jah
 245   1              */      
 246   1              if (keytimeout>1)        keytimeout--;          //leave 1 for keytimeout to be detected and deduct  
 247   1      }                                                       //at checkkeytimeout()
 248          /****************************************************************************************************
 249          External interrupt 0 
 250          Take care of the DEMOD_IN input from the EM4095
 251          *****************************************************************************************************/
 252          void ex0_isr (void) interrupt 0//void ex1_isr (void) interrupt 2
 253          {
 254   1              cardtime = 0;   //11/19/2005 4:21PM removed to prevent some noise signal IN
 255   1              TR0=0;
 256   1              TH0 = 0xff;
 257   1              TL0 = TIMER0CNT;
 258   1              TR0=1;
 259   1              
 260   1              
 261   1              
 262   1              if(!anticollision)                                      //kk 21/10/05
 263   1              {
 264   2              if(clock_isr_counter1 >= 4)                                                                                     //600us ;phase change in data format
 265   2              {
 266   3                      //P02^=1;
 267   3                      if((previousstate==HIGH)||(clock_isr_counter1>=6))//7//(100/CLOCKINTERVAL)))//change state from 1 to 0, 
             -read in 1 follow by 0
 268   3                      {       
 269   4                              
 270   4                              nibin  |= 0x01; 
 271   4                              cbitcount++;                    
 272   4                              bitcount++;
 273   4                              nibin = nibin <<1;
 274   4                              parity++;                       
 275   4                              if ((cbitcount <=60) && (cbitcount >=11))       
 276   4                              {
 277   5                                  if (bitcount == 5)
 278   5                                  {
 279   6                                      if(parity & 0x01)                       //odd parity
 280   6                                      {
 281   7                                              cardbytein[bytecount++]= (~(nibin>>2)) & 0x0f;
 282   7                                              
 283   7                                              if (bytecount>=MAXCARDCHAR)
 284   7                                              {
 285   8                                                      cardbytein[bytecount+1]=0;
 286   8                                                      CardDataIn      =       1;              
 287   8                                                      anticollision   =1;                     //kk 21/10/05
 288   8                                                      cardtime        =       18;
 289   8                                                      SHD=SLEEP; //11/28/2005 9:05PM  
 290   8                                                                      
 291   8                                                      }                                       
 292   7                                      }
 293   6                                      
C51 COMPILER V7.06   READERMODULE                                                          09/05/2006 01:45:27 PAGE 6   

 294   6                                      else
 295   6                                      {                                       
 296   7                                              cbitcount = 0;                                                                  
 297   7                                              startpattern=0;
 298   7                                              rdr=0;                          //redetect upon state change of 1 to 0
 299   7                                      }
 300   6                                      bitcount  = 0;                          //after every 5 bits reset bit count
 301   6                                      nibin     = 0;                          //after every 5 bits reset nibin
 302   6                                      parity    = 0;
 303   6                                  }           
 304   5                                  nibin &= 0xfe;          
 305   5                                  cbitcount++;                        
 306   5                                  bitcount++;                         
 307   5                                  nibin = nibin <<1;  
 308   5                                  ch=0;                               
 309   5                                  
 310   5                              }
 311   4                              else if(cbitcount >=61)         
 312   4                              {
 313   5                                  if (bitcount == 5)                          //after 1 bit shifted, bit count up to 5  
 314   5                                  {                                           //take care of the 0 bit left behind!!                          
 315   6                                      if(1)//!ch)                             //stop bit
 316   6                                      {
 317   7                                              cbitcount       =       0;
 318   7                                              //CardDataIn      =     1;
 319   7                                              rdr             =       0;      
 320   7                                              columnparity    =       nibin&0x0f;
 321   7                                              cardtime        =       18;
 322   7                                              startpattern    =       0;
 323   7                                              bytecount=0;
 324   7                                              bitcount  = 0;                  //reset all parameter, search for the 
 325   7                                              nibin     = 0;                  //correct start pattern                                 
 326   7                                      }
 327   6                                  }                       
 328   5                                  else
 329   5                                  {
 330   6                                      cbitcount++;    
 331   6                                      bitcount++;     
 332   6                                      nibin &= 0xfe;                          
 333   6                                      nibin = nibin <<1;      
 334   6                                      ch=0;                                   //subsequent data will decoded as 0                                                     
 335   6                                  }                       
 336   5                              }
 337   4                              else                                            //especially for start pattern detection
 338   4                              { 
 339   5                                      if(startpattern<9)//if(!startpattern)
 340   5                                      {
 341   6                                              startpattern=1;
 342   6                                              rdr=1;
 343   6                                              cbitcount=1;
 344   6                                      }       
 345   5                                      cbitcount++;    
 346   5                                      bitcount++;             
 347   5                                      nibin &= 0xfe;                  
 348   5                                      nibin = nibin <<1;      
 349   5                                      ch=0;                                   //subsequent data will decoded as 0                                                     
 350   5                              }                               
 351   4                      }
 352   3                      else                                                    //change state from 0 to 1, read in 1 
 353   3                      {       
 354   4                              
 355   4                              if(rdr)                                         //start all data decoding upon the possible of start pattern detection
C51 COMPILER V7.06   READERMODULE                                                          09/05/2006 01:45:27 PAGE 7   

 356   4                              {
 357   5                                      if(cbitcount<10)                        //change state before start pattern detected
 358   5                                      {
 359   6                                              bitcount  = 0;                  //reset all parameter, search for the 
 360   6                                              nibin     = 0;                  //correct start pattern
 361   6                                              cbitcount = 0;                          
 362   6                                              parity    = 0;
 363   6                                              startpattern=0;
 364   6                                              rdr=0;                                  
 365   6                                      }
 366   5                                      else 
 367   5                                      {
 368   6                                              nibin |= 0x01;          
 369   6                                              bitcount++;
 370   6                                              cbitcount++;
 371   6                                              nibin = nibin << 1;             //shift data 1 to buffer
 372   6                                              ch=1;                           //subsequent signal will decoded as 1                                   
 373   6                                              parity++;                                               
 374   6                                      }
 375   5                              }                       
 376   4                      }                       
 377   3              }       
 378   2              else                                                            //in normal data cycle
 379   2              {
 380   3                      if(rdr)                                                 //once a 1 to 0 state change was detected, enable
 381   3                      {                                                       //subsequent incoming data                              
 382   4                              if(!ch) //9/10/2005 10:09AM                                     // data 0
 383   4                              {               
 384   5                                      if(cbitcount<=10)       
 385   5                                              startpattern++;
 386   5                                      
 387   5                                      nibin &= 0xfe;                          
 388   5                              }
 389   4                              else //if(ch)//(ch==1)-9/4/2005 10:48PM
 390   4                              {
 391   5                                      
 392   5                                      nibin  |= 0x01;                         //data 1
 393   5                                      parity++;                               
 394   5                              }       
 395   4                              bitcount++;
 396   4                              cbitcount++;
 397   4                              nibin = nibin << 1;
 398   4                              nibin &= 0x3f;                                  //If bitcount count up to five then 00xx xxxx
 399   4                      }       
 400   3              }
 401   2              
 402   2              if (cbitcount==10)                                              //after 9 bits received -included 1 high from interchange state
 403   2              {
 404   3                      if(startpattern == 9)                                   //but not all 0(count from 1)
 405   3                      {       
 406   4                              
 407   4                      }
 408   3                      else 
 409   3                      {                                               
 410   4                              cbitcount = 0;                          
 411   4                              startpattern=0;
 412   4                              rdr=0;                                          //redetect upon state change of 1 to 0
 413   4                                                      
 414   4                      }                       
 415   3                      bytecount=0;
 416   3                      bitcount  = 0;                                          //reset all parameter, search for the 
 417   3                      nibin     = 0;                                          //correct start pattern                                         
C51 COMPILER V7.06   READERMODULE                                                          09/05/2006 01:45:27 PAGE 8   

 418   3                      parity    = 0;
 419   3              }
 420   2              
 421   2              else if ((cbitcount <=60) && (cbitcount >=11))  

⌨️ 快捷键说明

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