1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Micro controller Programming

Discussion in 'Microcontrollers' started by M. Tamilarasan, Nov 6, 2013.

  1. M. Tamilarasan

    M. Tamilarasan Member

    Joined:
    Nov 6, 2013
    Messages:
    53
    Likes:
    0
    Hiiiiii...anybody help me regarding interfacing NFC card reader with PIC 18f14k50 along with i2c code using mickro c compiler
     
  2. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    What kind of problems are you having? Code? Circuit? what?
    What kind of NFC card reader you have? Any links to a datasheet, specs etc.?
     
    Last edited: Nov 6, 2013
  3. M. Tamilarasan

    M. Tamilarasan Member

    Joined:
    Nov 6, 2013
    Messages:
    53
    Likes:
    0
    PN532
    How to write our own data into the NFC card using its reader and how to retrieve the stored data from the card using arduino board
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. tunedwolf

    tunedwolf Well-Known Member

    Joined:
    Aug 9, 2006
    Messages:
    1,080
    Likes:
    62
    Location:
    UK

    Check out the Adafruit site, there's some tutorials and libraries there too :)

    There are various suppliers of NFC modules on ebay, most supply documentation and libraries etc. Here's one that looks interesting: http://www.ebay.co.uk/itm/PN532-NFC-RFID-Reader-Writer-Module-Arduino-Compatible-/271126360391
     
  6. M. Tamilarasan

    M. Tamilarasan Member

    Joined:
    Nov 6, 2013
    Messages:
    53
    Likes:
    0
    Thank you....
     
  7. M. Tamilarasan

    M. Tamilarasan Member

    Joined:
    Nov 6, 2013
    Messages:
    53
    Likes:
    0
    Whether It is possible to change the key and access bits of NFC card PN532
     
  8. tunedwolf

    tunedwolf Well-Known Member

    Joined:
    Aug 9, 2006
    Messages:
    1,080
    Likes:
    62
    Location:
    UK
    The whole point of authentication and encryption is to keep data and systems secure that use NFC, so I won't be helping you to perform a hack. Most new cards as far as I know will allow full access to the data blocks using Key A. However, to answer your question, yes the MiFare chipsets have been compromised by some less scrupulous types, so it is possible :)
     
  9. M. Tamilarasan

    M. Tamilarasan Member

    Joined:
    Nov 6, 2013
    Messages:
    53
    Likes:
    0
    we planned to use the NFC card for some applications...After completion of it we need to encrypt it with our own access bits and keys....
     
  10. M. Tamilarasan

    M. Tamilarasan Member

    Joined:
    Nov 6, 2013
    Messages:
    53
    Likes:
    0
    how to split the given serial input data comprised of both characters and numbers into separate strings using arduino..
     
  11. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    I assume that you are sending ascii text. Compare the incoming data value to the ascii table values. Number characters have values from 48 to 57.

    If you are sending raw number values (integers, floats etc.) mixed with ascii text. Then you need to define a simple protocol that sends well defined datapackets.

    "Using Arduino" means that you are probably coding in C.

    It is very difficult to give more advice without knowing the details of the serial data. Can you give an example of incoming data and what you need to do with it.
     
  12. M. Tamilarasan

    M. Tamilarasan Member

    Joined:
    Nov 6, 2013
    Messages:
    53
    Likes:
    0
    ya....i want to send serial data for example : Get0100300

    it should print in serial monitor as
    Ge
    t0
    10
    03
    00

    My thanks in advance for your valuable solution.....!!!
     
  13. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    I still don't understand what exactly is the problem. You do not know how to send data, or you do not know how to convert numbers to strings, or you do not know how to split the string in 2 character groups.. what is it?
     
  14. M. Tamilarasan

    M. Tamilarasan Member

    Joined:
    Nov 6, 2013
    Messages:
    53
    Likes:
    0
    i don't know how to split strings ..
     
  15. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    One simple solution is (using Arduino sketch):

    Code (C):

    char buf[] = "Get0100300";

    Serial.write(&buf[0], 2);
    Serial.write(&buf[2], 2);
    Serial.write(&buf[4], 2);
    Serial.write(&buf[6], 2);
    Serial.write(&buf[8], 2);
     
    that should print:
    Ge
    t0
    10
    03
    00

    If that does not print the newlines properly, then you need to write:
    Code (C):

    char buf[] = "Get0100300";

    Serial.write(&buf[0], 2);
    Serial.write("\n\r");
    Serial.write(&buf[2], 2);
    Serial.write("\n\r");
    Serial.write(&buf[4], 2);
    Serial.write("\n\r");
    Serial.write(&buf[6], 2);
    Serial.write("\n\r");
    Serial.write(&buf[8], 2);
    Serial.write("\n\r");
     
    That code adds newlines "manually". The bad documentation of Arduino sketch functions didn't say if those lines are needed or not.
     
    Last edited: Nov 25, 2013
  16. M. Tamilarasan

    M. Tamilarasan Member

    Joined:
    Nov 6, 2013
    Messages:
    53
    Likes:
    0
    After we execute the code...we have to give "Get0100300" as input in serial monitor and press enter... it should print in serial monitor as
    Ge
    t0
    10
    03
    00
     
  17. M. Tamilarasan

    M. Tamilarasan Member

    Joined:
    Nov 6, 2013
    Messages:
    53
    Likes:
    0
    i want to compare the 4 byte UID of multiple NFC tags using arduino....i bought nfc reader from elechouse.com

    To use single NFC tag as admin card...
     
  18. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
    It is impossible to help you when you give out small pieces of information here and there. Why don't you describe the whole system and also tell us what you have done so far. Post all the code working code you have so far. And detailed info what you are trying to accomplish.
     
  19. misterT

    misterT Well-Known Member Most Helpful Member

    Joined:
    Apr 19, 2010
    Messages:
    2,697
    Likes:
    368
    Location:
    Finland
  20. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,151
    Likes:
    907
    Location:
    Rochdale UK
    ONLINE
    Hold on!!!! When did you shift to Arduino!!! It started as mikroC on a pic18f14k50..

    String manipulation in C is one of the easiest to perform..

    First you use strtok() to split the string.... then use strncpy() to get the Alpha / numeric parts..

    As MrT has already stated..... Show me the string that you receive and tell me what needs splitting!!
     
  21. M. Tamilarasan

    M. Tamilarasan Member

    Joined:
    Nov 6, 2013
    Messages:
    53
    Likes:
    0
    How to convert UID of NFC tag into string...Usually the UID will be in bytes
     

Share This Page