Reading RFID using C

This is a discussion on Reading RFID using C within the C Programming forums, part of the General Programming Boards category; Originally Posted by Salem But I bet they have a website right? It 's made by this manufacturer . My ...

  1. #16
    Registered User
    Join Date
    Sep 2010
    Posts
    41
    Quote Originally Posted by Salem View Post
    But I bet they have a website right?
    It 's made by this manufacturer .
    My model is MF800

  2. #17
    Registered User
    Join Date
    Sep 2010
    Posts
    41
    Quote Originally Posted by CommonTater View Post
    I think you missed my point... Get the thing connected and talking on your port before you worry about anything else... Scan a few tabs and even if it displays garbage, you are one step closer to your goal.

    Sometimes these things surprise you and communicate in plain text... The first bar code scanner I worked on nearly put me on the floor when the text on the screen was exactly what was printed under the barcode... The mass comment was "Naaaa, that's just too easy..."
    you surprise me as you have some expriecnce about that!
    I can see a light in front of me, haha.

    Seriously, the thing i need to do first is to learn the knowledge of serial port communication,right?
    Would you please share some reference to me?
    Last edited by anthonyung; 03-04-2011 at 11:06 AM.

  3. #18
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by anthonyung View Post
    you surprise me as you have some expriecnce about that!
    I can see a light infront of me, haha.

    Seriously, the thing i need to do first is to learn the knowledge of serial port communication,right?
    You should have some basis in configuring and using a serial port by now... from the other project you said you worked on. The code from that may provide something of a starting point.

    In C you should include <windows.h> (even if not creating a GUI project) and look at the
    CreateFile Function (Windows) , ReadFile Function (Windows) and DeviceIoControl Function (Windows) functions to see how to setup and read the port....

    From the page you linked, I'd set the serial port to 9600, no parity, 8 data bits, 1 stop bit, open the port as a file (as I'm sure you did on the other project), capture the input to a string (again something you probably did on the other project), then try swiping a few cards and display the output on your screen...

    If you can get that much to work, you're more than half way there...

    For the actual content: If it's not obviuos (like my barcode scanners were) look in the supplied code for a struct that you might overlay on the strings to extract the data...

    But for now the first step is to see input on your screen.

    As for my experience with this : I was the national service manager for a major office machine company for most of my career. (Now retired... or is that just plain tired?)
    Last edited by CommonTater; 03-04-2011 at 11:15 AM.

  4. #19
    Registered User
    Join Date
    Sep 2010
    Posts
    41
    Quote Originally Posted by CommonTater View Post
    You should have some basis in configuring and using a serial port by now... from the other project you said you worked on. The code from that may provide something of a starting point.

    From the page you linked, I'd set the serial port to 9600, no parity, 8 data bits, 1 stop bit, open the port as a file (as I'm sure you did on the other project), capture the input to a string (again something you probably did on the other project), then try swiping a few cards and display the output on your screen...

    If you can get that much to work, you're more than half way there...

    For the actual content: If it's not obviuos (like my barcode scanners were) look in the supplied code for a struct that you might overlay on the strings to extract the data...

    But for now the first step is to see input on your screen.

    As for my experience with this : I was the national service manager for a major office machine company for most of my career. (Now retired... or is that just plain tired?)
    Cool, thank you so much!

    Actually...i started with nothing(about serial port), i am learning the knowledge of microcontroller(A set of kit), but that is another subject, the RFID i used is a project subject, my friend and i thought using RFID maybe easy to achieve...but i guess we are wrong now..

  5. #20
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Ok... so is this attaching to a PC or a uC? And... which version of C are you using?

    Fear not... any task is daunting before the first step is taken.

    One idea might be to get it working on a PC first then modify the code for your uC...

  6. #21
    Registered User
    Join Date
    Sep 2010
    Posts
    41
    Quote Originally Posted by CommonTater View Post
    Ok... so is this attaching to a PC or a uC? And... which version of C are you using?

    Fear not... any task is daunting before the first step is taken.

    One idea might be to get it working on a PC first then modify the code for your uC...
    No. it is just a console application, is it possible to achieve my idea?
    you meant the software i used? that is VC++ 6.0.

  7. #22
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    You have C++ ... why not just use the supplied libraries?

  8. #23
    Registered User
    Join Date
    Sep 2010
    Posts
    41
    Oh, sorry, you meant my uC subject? it 's attaching to a uC, you're right. the software i am using for this is Keil.
    but now i am using VC to read the mifare.

  9. #24
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,588
    This is hard work - where's the souce code (getting bored of asking)?

    Anyway, it says RS232, so the first thing to try is just running hyperterminal and seeing what gets displayed. It makes a point of being "easy to integrate", so I guess it's just printable text with a newline at the end.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  10. #25
    Registered User
    Join Date
    Sep 2010
    Posts
    41
    Quote Originally Posted by CommonTater View Post
    You have C++ ... why not just use the supplied libraries?
    Could those be used in typing C style?

  11. #26
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Salem View Post
    This is hard work - where's the souce code (getting bored of asking)?

    Anyway, it says RS232, so the first thing to try is just running hyperterminal and seeing what gets displayed. It makes a point of being "easy to integrate", so I guess it's just printable text with a newline at the end.
    Excellent suggestion....

    Hook the thing up to your PC, launch hyperterminal as Salem suggests, and see what comes out of it. (Thanks Salem!)

    Thing is, smart cards often incorporate some form of data encryption... as a security measure.


    FWIW... a lot of the stuff I worked on ended up being connected to cash registers but almost all code development was done on PCs first.
    Last edited by CommonTater; 03-04-2011 at 11:39 AM.

  12. #27
    Registered User
    Join Date
    Sep 2010
    Posts
    41
    Quote Originally Posted by Salem View Post
    This is hard work - where's the souce code (getting bored of asking)?

    Anyway, it says RS232, so the first thing to try is just running hyperterminal and seeing what gets displayed. It makes a point of being "easy to integrate", so I guess it's just printable text with a newline at the end.
    Sorry,here it is - VC

  13. #28
    Registered User
    Join Date
    Sep 2010
    Posts
    41
    Can you dnowload it?

  14. #29
    Registered User
    Join Date
    Mar 2010
    Posts
    90
    I am total newbie in C but I often read and write to COM port in windows, dos and linux. So I try to do like in old days and this works:

    Code:
    fout = fopen("COM1,9600,N,8,1", "w"); // for writing to port
    You can open Com port exactly like file. Be carfeul about CR and LF chars which may vary depends on what you read and what device sends!
    If this dont work you should try with other standard setting like 300, 900, 1200, 2400, 3600, 19200 etc...

    In windows is important that your port settings on machine (control panel) DO MATCH with your program and your connected device.
    Reading of RFID data is same like reading data from any COM connectable device.
    In most cases you dont need any software for minimal usage.

  15. #30
    Registered User
    Join Date
    Sep 2010
    Posts
    41
    Quote Originally Posted by nime View Post
    I am total newbie in C but I often read and write to COM port in windows, dos and linux. So I try to do like in old days and this works:

    Code:
    fout = fopen("COM1,9600,N,8,1", "w"); // for writing to port
    You can open Com port exactly like file. Be carfeul about CR and LF chars which may vary depends on what you read and what device sends!
    If this dont work you should try with other standard setting like 300, 900, 1200, 2400, 3600, 19200 etc...

    In windows is important that your port settings on machine (control panel) DO MATCH with your program and your connected device.
    Reading of RFID data is same like reading data from any COM connectable device.
    In most cases you dont need any software for minimal usage.
    Thanks! Do i need to include any header file?

Page 2 of 3 FirstFirst 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 02-02-2009, 06:27 AM
  2. Resetting a ifstream object after reading the whole file
    By Zeeshan in forum C++ Programming
    Replies: 5
    Last Post: 03-31-2008, 08:03 AM
  3. Replies: 2
    Last Post: 01-28-2008, 02:07 AM
  4. help with reading from stream
    By movl0x1 in forum C Programming
    Replies: 7
    Last Post: 05-31-2007, 10:36 PM
  5. problems reading data into an array and printing output
    By serino78 in forum C Programming
    Replies: 4
    Last Post: 04-28-2003, 08:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21