FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    Using 51 single-chip microcomputers to quickly achieve super cost-effective RFID card circuit solution design

     

    I have been busy with this RFID in these two days. First of all, I admit that I am a rookie, the platform is based on the 51 single-chip microcomputer introduced by beginners, but I still summarize the recent gain of the code. Software design of card reader: Look at the PDF document seems to have been given, but beginners, understanding is also a long time, here I suggest the design process in Datasheet, in combination with code analysis, to achieve the effect of identifying the card. The first thing is to be a reset answer. According to Datasheet, the communication protocol of the MIFARE RF card and the baud rate of communication are defined. When the card enters the card reader, the card reader will be specific. The agreement communicates with him, and it is judged whether the entry card is Mifare RF card In fact, Datasheet seems to be very hanging, but in fact, it is actually a feeling that can't touch the mind. In fact, I read the code, I know that the software on the software is initialized, and the card reader is going once. Software reset, and set the method of working card reader The code here is: PCDReset (); // RC522 initialization PCDANTENNAOFF (); // Close antenna PCDANTENNAON (); // Open antenna M500pcdconfigisotype ('a'); // Setting working mode The second step is to prevent conflict, in DataSheet: When there are multiple cards entering the sensing range of the card reader, the anti-conflict mechanism will start, automatically operate from multiple cards, then there is a lot of words, speak How to prevent conflict In fact, personal feelings is still important, because not reading card, where to prevent conflict, in fact, anti-conflict speaking so much implementation is a function Status = pcdRequest (PICC_REQALL, G_UCTEMPBUF); // picc_reqall he is a macro definition means looking for all cards in the antenna, // g_uctempbuf is an array where the first two digits in the card here are placed in arrays. Status = pcdanticoll (g_uctempbuf); / / Anti-conflict It is a bit more meaning that sometimes it is necessary to implement the type of judgment card. There is a fragment here, you should use the program. Judgment the type of card, judge the first data returned when the card is read, and other functions are 12864, you don't have to go further. // Is there a card, judge what card, then display it on the LCD // 0x4400 = mifare_ultralight // 0x0400 = mifare_one (S50) // 0x0200 = mifare_one (S70) // 0x0800 = mifare_pro (x) // 0x4403 = Mifare_Desfire Switch (g_uctempbuf [0]) { Case 0x44: CK12864_COM (0x93); For (i = 0; I<10; i ++) { CK12864_Data (leiXing1 [i]); } Break; Case 0x02: CK12864_COM (0x93); For (i = 0; I<8; i ++) { CK12864_DATA (leiXing2 [i]); } Break; Case 0x04: CK12864_COM (0x93); For (i = 0; I<8; i ++) { CK12864_DATA (leiXing3 [i]); } Break; Case 0x08: CK12864_COM (0x93); For (i = 0; I<6; i ++) { CK12864_DATA (leiXing4 [i]); } Break; } Next is the process 3, select the card, operate on the card, according to Datasheet, the sequence code of the selected card, and return to the card at the same time: Code implementation: Status = pcdselect (g_uctempbuf); Process 4, that is, the selection card is operated, first verify the password, including read and write operations The implementation of the code is also two sentences: Status = pcdauthState (PICC_AUTHENT1A, 5, DefaultKey, g_uctempbuf); IF (status! = mi_ok) {Continue; // Write data to block Status = PCDWRITE (5, DATA1); IF (status! = mi_ok) {Continue; // Read a piece of data Process 5: Intention to sleep: PCDHALT (); This 5 steps can realize the specific operation of the card, now we can control stepper motors by credit card, actually omitted step 4 If you do an unnamed credit card, that is, there is no opening door that is bound to a specific card number, now you can implement it. Sample code: #include #include "mian.h" #include "rc522.h" Typedef unsigned int uint Typedef unsigned char uchar; Uchar status; Uchar g_uctempbuf [20]; void main () { UINT I; // Initialization: PCDReset (); // RC522 initialization PCDANTENNAOFF (); // Close and open antenna PCDANTENNAON (); M500pcdconfigisotype ('a'); // Setting working mode / / Anti-conflict, where a loop is required, let the card reader continue to read the card While (1) { Status = pcdRequest (PICC_REQALL, G_UCTEMPBUF); // picc_reqall he is a macro definition means looking for all cards in the antenna, // g_uctempbuf is an array where the first two digits in the card here are placed in arrays. IF (status! = mi_ok) // No card is found, continue to execute pcdRequest () { CONTINUE; } Status = pcdanticoll (g_uctempbuf); / / Anti-conflict // Card sequence number, 4 bytes, the status here can determine the implementation of PCDanticoll // If the execution is successful, it means that the g_uctempbuf has been remembered in the only card number. // Here G_UCTEMPBUF has used 2 + 4 IF (status! = mi_ok) // No card is found, continue to execute pcdRequest () { CONTINUE; } PCDHALT (); IF (status == mi_ok) { LED_GREEN = 0; For (i = 0; I<125; i ++) { Step (); } LED_GREEN = 1; } } } Void delayms (unsigned int _ms) { TH1 = (unsigned char) (RCAP2_1MS>>8); TL1 = (unsigned char) (RCAP2_1MS); ET1 = 0; // disable timer2 interrupt

     

     

     

     

    List all Question

    Nickname

    Email

    Questions

    Our other product:

    Professional FM Radio Station Equipment Package

     



     

    Hotel IPTV Solution

     


      Enter email  to get a surprise

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->Afrikaans
      sq.fmuser.org ->Albanian
      ar.fmuser.org ->Arabic
      hy.fmuser.org ->Armenian
      az.fmuser.org ->Azerbaijani
      eu.fmuser.org ->Basque
      be.fmuser.org ->Belarusian
      bg.fmuser.org ->Bulgarian
      ca.fmuser.org ->Catalan
      zh-CN.fmuser.org ->Chinese (Simplified)
      zh-TW.fmuser.org ->Chinese (Traditional)
      hr.fmuser.org ->Croatian
      cs.fmuser.org ->Czech
      da.fmuser.org ->Danish
      nl.fmuser.org ->Dutch
      et.fmuser.org ->Estonian
      tl.fmuser.org ->Filipino
      fi.fmuser.org ->Finnish
      fr.fmuser.org ->French
      gl.fmuser.org ->Galician
      ka.fmuser.org ->Georgian
      de.fmuser.org ->German
      el.fmuser.org ->Greek
      ht.fmuser.org ->Haitian Creole
      iw.fmuser.org ->Hebrew
      hi.fmuser.org ->Hindi
      hu.fmuser.org ->Hungarian
      is.fmuser.org ->Icelandic
      id.fmuser.org ->Indonesian
      ga.fmuser.org ->Irish
      it.fmuser.org ->Italian
      ja.fmuser.org ->Japanese
      ko.fmuser.org ->Korean
      lv.fmuser.org ->Latvian
      lt.fmuser.org ->Lithuanian
      mk.fmuser.org ->Macedonian
      ms.fmuser.org ->Malay
      mt.fmuser.org ->Maltese
      no.fmuser.org ->Norwegian
      fa.fmuser.org ->Persian
      pl.fmuser.org ->Polish
      pt.fmuser.org ->Portuguese
      ro.fmuser.org ->Romanian
      ru.fmuser.org ->Russian
      sr.fmuser.org ->Serbian
      sk.fmuser.org ->Slovak
      sl.fmuser.org ->Slovenian
      es.fmuser.org ->Spanish
      sw.fmuser.org ->Swahili
      sv.fmuser.org ->Swedish
      th.fmuser.org ->Thai
      tr.fmuser.org ->Turkish
      uk.fmuser.org ->Ukrainian
      ur.fmuser.org ->Urdu
      vi.fmuser.org ->Vietnamese
      cy.fmuser.org ->Welsh
      yi.fmuser.org ->Yiddish

       
  •  

    FMUSER Wirless Transmit Video And Audio More Easier !

  • Contact

    Address:
    No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620

    E-mail:
    [email protected]

    Tel / WhatApps:
    +8618078869184

  • Categories

  • Newsletter

    FIRST OR FULL NAME

    E-mail

  • paypal solution  Western UnionBank OF China
    E-mail:[email protected]   WhatsApp:+8618078869184   Skype:sky198710021 Chat with me
    Copyright 2006-2020 Powered By www.fmuser.org

    Contact Us