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

📄 main.lst

📁 实现射频卡的读写
💻 LST
📖 第 1 页 / 共 5 页
字号:
 261      =1  //    RETURN: 
 262      =1  //   COMMENT: This function writes a given length of data bytes stored in the data  
 263      =1  // 	      buffer to the reader IC's EEPROM beginning at address <em>startaddr</em>. 
 264      =1  //
 265      =1  char PcdWriteE2(unsigned short startaddr,
 266      =1                  unsigned char length,
 267      =1                  unsigned char* _data);
 268      =1  
 269      =1  // _____________________________________________________________________________
 270      =1  //
 271      =1  //  FUNCTION: M500PcdMfOutSelect
 272      =1  //        IN: type      The signal to be appear at MfOut pin 
 273      =1  //
 274      =1  //		000: Constant Low
 275      =1  //		001: Constant High
 276      =1  //		010: Modulation signal from the internal coder, Miller coded
 277      =1  //		011: Serial data stream, not Miller coded
 278      =1  //		100: Output signal of the energy carrier demodulator
 279      =1  //		101: Output signal of the subcarrier demodulator
 280      =1  //		110: RFU
 281      =1  //		111: RFU
 282      =1  //       OUT: -
 283      =1  //    RETURN: 
 284      =1  //   COMMENT: This function config the output of the MfOut pin
 285      =1  //                     
 286      =1  char M500PcdMfOutSelect(unsigned char type);
 287      =1                       
 288      =1  // _____________________________________________________________________________
 289      =1  //
 290      =1  //  FUNCTION: M500PcdWriteRegister
 291      =1  //        IN: Reg      	Register address
 292      =1  //	      value	value to be written	 
 293      =1  //       OUT: -
C51 COMPILER V6.10  MAIN                                                                   01/19/2009 23:06:47 PAGE 13  

 294      =1  //    RETURN: 
 295      =1  //   COMMENT: This function write the value to the RC500 register
 296      =1  //                     
 297      =1  char M500PcdWriteRegister(unsigned char Reg, unsigned char value);
 298      =1  
 299      =1  // _____________________________________________________________________________
 300      =1  //
 301      =1  //  FUNCTION: M500PcdReadRegister
 302      =1  //        IN: Reg      	Register address 
 303      =1  //       OUT: -
 304      =1  //    RETURN: value	value of register
 305      =1  //   COMMENT: This function read the value of the RC500 register
 306      =1  //                     
 307      =1  char M500PcdReadRegister(unsigned char Reg);
 308      =1  
 309      =1  // _____________________________________________________________________________
 310      =1  //
 311      =1  //  FUNCTION: M500PiccRequest
 312      =1  //        IN: rq_code  can take the following values
 313      =1  //                     ALL   Request Code 52hex is sent out to get also a 
 314      =1  //                           response from cards in halt state.
 315      =1  //                     IDLE  Request Code 26hex is sent out to get a response 
 316      =1  //                           only from cards that are not in halt state.
 317      =1  //                     Note: Future cards will work also with other request 
 318      =1  //                           codes.
 319      =1  //       OUT: atq      16 bit ATQ (answer to request). 
 320      =1  //                     atq[0] .. LSByte
 321      =1  //                     atq[1] .. MSByte
 322      =1  //    RETURN: 
 323      =1  //   COMMENT: This function accesses the reader module and activates sending the
 324      =1  //            REQ code to the MIFARE card. After sending the command to the card 
 325      =1  //            the function waits for the card's answer.
 326      =1  //
 327      =1  //            Please note, that the actual work is done by the function
 328      =1  //            M500PiccCommonRequest, because of the interface behaviour between
 329      =1  //            Mifare and ISO 14443
 330      =1  //
 331      =1  //            The Card replies the ATQ.
 332      =1  //
 333      =1  //            ATQ:
 334      =1  //
 335      =1  //                    +----+----+----+----+----+----+----+----+
 336      =1  //            LSByte  | b8 | b7 | b6 | b5 | b4 | b3 | b2 | b1 |
 337      =1  //                    +----+----+----+----+----+----+----+----+
 338      =1  //                    |         |    |                        |
 339      =1  //                    | UID size| RFU|   bit-frame anticoll   |
 340      =1  //                    |         |    |                        |
 341      =1  //                    | 00..std |    |  (if any bit set .. Y, |
 342      =1  //                    | 01..dbl |    |             else .. N) |
 343      =1  //                    | 10..tpl |    |                        |
 344      =1  //
 345      =1  //
 346      =1  //
 347      =1  //                    +----+----+----+----+----+----+----+----+
 348      =1  //            MSByte  | b8 | b7 | b6 | b5 | b4 | b3 | b2 | b1 |
 349      =1  //                    +----+----+----+----+----+----+----+----+
 350      =1  //                    |                                       |
 351      =1  //                    |                 RFU                   |
 352      =1  //                    |                                       |
 353      =1  //
 354      =1  char M500PiccRequest(unsigned char req_code, 
 355      =1                         unsigned char *atq);
C51 COMPILER V6.10  MAIN                                                                   01/19/2009 23:06:47 PAGE 14  

 356      =1  // _____________________________________________________________________________
 357      =1  //
 358      =1  //  FUNCTION: M500PiccCommonRequest
 359      =1  //        IN: rq_code  can take the following values
 360      =1  //                     ALL   Request Code 52hex is sent out to get also a 
 361      =1  //                           response from cards in halt state.
 362      =1  //                     IDLE  Request Code 26hex is sent out to get a response 
 363      =1  //                           only from cards that are not in halt state.
 364      =1  //                     Note: Future cards will work also with other request 
 365      =1  //                           codes.
 366      =1  //       OUT: atq      16 bit ATQ (answer to request). 
 367      =1  //                     atq[0] .. LSByte
 368      =1  //                     atq[1] .. MSByte
 369      =1  //    RETURN: 
 370      =1  //   COMMENT: Please note, that this function does the actual work which is 
 371      =1  //            described in function M500PiccRequest.
 372      =1  //
 373      =1  char M500PiccCommonRequest(unsigned char req_code, 
 374      =1                               unsigned char *atq);  
 375      =1  
 376      =1  // _____________________________________________________________________________
 377      =1  //
 378      =1  //  FUNCTION: M500PiccAnticoll
 379      =1  //        IN: bcnt       Number of snr-bits that are known (default value is 0)
 380      =1  //            *snr       4 bytes serial number (number of bits, which
 381      =1  //                       are known and indicated by "bcnt"
 382      =1  //       OUT: *snr       4 bytes serial number, determined by the anticollision
 383      =1  //                       sequence
 384      =1  //    RETURN: 
 385      =1  //   COMMENT: The actual anticollision loop is done by the function
 386      =1  //            "M500PiccCascAnticoll". Which is called with select_code 0x93.
 387      =1  //
 388      =1  char M500PiccAnticoll (unsigned char bcnt,
 389      =1                           unsigned char *snr);
 390      =1  
 391      =1  // _____________________________________________________________________________
 392      =1  //
 393      =1  //  FUNCTION: M500PiccCascAnticoll
 394      =1  //        IN: select_code    0x93  standard select code
 395      =1  //                           0x95  cascaded level 1
 396      =1  //                           0x97  cascaded level 2
 397      =1  //            bcnt       Number of snr-bits that are known (default value is 0)
 398      =1  //            *snr       4 bytes serial number (number of bits, which
 399      =1  //                       are known and indicated by "bcnt"
 400      =1  //       OUT: *snr       4 bytes serial number, determined by the anticollision
 401      =1  //                       sequence
 402      =1  //    RETURN: 
 403      =1  //   COMMENT: Corresponding to the specification in ISO 14443, this function
 404      =1  //            is able to handle extended serial numbers. Therefore more than
 405      =1  //            one select_code is possible. The function transmitts a 
 406      =1  //            select code and all ready tags are responding. The highest
 407      =1  //            serial number within all responding tags will be returned by 
 408      =1  //            this function.
 409      =1  //                     
 410      =1  char M500PiccCascAnticoll (unsigned char select_code,
 411      =1                               unsigned char bcnt,
 412      =1                               unsigned char *snr);                     
 413      =1  
 414      =1  // _____________________________________________________________________________
 415      =1  //
 416      =1  //  FUNCTION: M500PiccSelect
 417      =1  //        IN: *snr      4 bytes serial number
C51 COMPILER V6.10  MAIN                                                                   01/19/2009 23:06:47 PAGE 15  

 418      =1  //       OUT: *sak      1 byte select acknowledge
 419      =1  //			xxxxx1xx: Cascade bit set: UID not complete
 420      =1  //			xx1xx0xx: UID complete,
 421      =1  //				  PICC compliant with ISO/IEC 14443-4
 422      =1  //			xx0xx0xx: UID complete,
 423      =1  //				  PICC not compliant with ISO/IEC 14443-4
 424      =1  //    RETURN: 
 425      =1  //   COMMENT: The actual select procedure is done by the function
 426      =1  //            "M500PiccCascSelect". Which is called with select_code 0x93.
 427      =1  //             
 428      =1  char M500PiccSelect(unsigned char *snr, 
 429      =1                        unsigned char *sak);
 430      =1  
 431      =1  // _____________________________________________________________________________
 432      =1  //
 433      =1  //  FUNCTION: M500PiccCascSelect
 434      =1  //        IN: select_code 
 435      =1  //            *snr          4 bytes serial number
 436      =1  //       OUT: *sak          1 byte select acknowledge
 437      =1  //    RETURN: 
 438      =1  //   COMMENT: Selects a UID level, depending on select code.
 439      =1  //            Returns Select Acknowledge byte.
 440      =1  //
 441      =1  //            Corresponding to the specification in ISO 14443, this function
 442      =1  //            is able to handle extended serial numbers. Therefore more than
 443      =1  //            one select_code is possible.
 444      =1  //
 445      =1  //            Select codes:
 446      =1  //
 447      =1  //            +----+----+----+----+----+----+----+----+
 448      =1  //            | b8 | b7 | b6 | b5 | b4 | b3 | b2 | b1 |
 449      =1  //            +-|--+-|--+-|--+-|--+----+----+----+-|--+
 450      =1  //              |    |    |    |  |              | |
 451      =1  //                                |              |
 452      =1  //              1    0    0    1  | 001..std     | 1..bit frame anticoll
 453      =1  //                                | 010..double  |
 454      =1  //                                | 011..triple  |
 455      =1  //
 456      =1  //            SAK:
 457      =1  //
 458      =1  //            +----+----+----+----+----+----+----+----+
 459      =1  //            | b8 | b7 | b6 | b5 | b4 | b3 | b2 | b1 |
 460      =1  //            +-|--+-|--+-|--+-|--+-|--+-|--+-|--+-|--+
 461      =1  //              |    |    |    |    |    |    |    |
 462      =1  //                        |              |
 463      =1  //                RFU     |      RFU     |      RFU
 464      =1  //
 465      =1  //                        1              0 .. UID complete, ATS available
 466      =1  //                        0              0 .. UID complete, ATS not available
 467      =1  //                        X              1 .. UID not complete
 468      =1  //
 469      =1  char M500PiccCascSelect(unsigned char select_code, 
 470      =1                              unsigned char *snr, 
 471      =1                              unsigned char *sak); 
 472      =1  
 473      =1  // _____________________________________________________________________________
 474      =1  //
 475      =1  //  FUNCTION: MfPiccAuth
 476      =1  //        IN: auth_mode PICC_AUTHENT1A or PICC_AUTHENT1B 
 477      =1  //                            selects master key A or master key B 
 478      =1  //                      KS0, KS1, KS2 selects one of the three master key sets.
 479      =1  //            *snr       4 byte serial number of the card, which should be 
C51 COMPILER V6.10  MAIN                                                                   01/19/2009 23:06:47 PAGE 16  

 480      =1  //                       authenticated
 481      =1  //            key_sector spec. the key RAM address from which the data should be
 482      =1  //                      taken (0..15)
 483      =1  //            block     addresses the block address on the card, which shall be
 484      =1  //                      authenticated. For MIFARE standard cards, addr can take 
 485      =1  //                      a value from 0 to 63, for other card types please refer
 486      =1  //                      to the according product description.
 487      =1  //       OUT: -
 488      =1  //    RETURN: 
 489      =1  //   COMMENT: This function authenticates one card's sector (according to the 
 490      =1  //            block address addr) using the specified mode and master key, 
 491      =1  //            addressed with key_addr. After sending the command to the card the 
 492      =1  //            function waits for the card's answer.
 493      =1  //            This function is calling compatible (exept the serial number) with
 494      =1  //            older authentication functions. The keys are stored by the 
 495      =1  //            microcontroller, which is capable for the key management.
 496      =1  //
 497      =1  char M500PiccAuth(unsigned char auth_mode, 

⌨️ 快捷键说明

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