|
|
View previous topic :: View next topic |
Author |
Message |
iamkennyk
Joined: 08 Apr 2009 Posts: 1
|
Sending 4-bits from RFID reader->hyperterminal->PIC18F |
Posted: Wed Apr 08, 2009 6:10 pm |
|
|
I am trying to set up an RFID system. I am fairly proficient in C++, but I am by no means proficient in C.
When the RFID reader detects a tag, it transmits a 4-bit ID (#'s and letters) via rs232. I can successfully view the tag ID on hyperterminal display. It continuously prints the 4-bit code about every 3 seconds, separated by spaces.
What I have not been able to do it is write a program that allows my PIC18F4620 board to read what ID is being sent to hyperterminal. I do not really have any code to display because I know I am not approaching the problem the ideal way. I am simply looking for ideas that any of you may conjure up after reading what is above.
Some questions I have:
Will I need to use gets() and is there a way I can make it only read the first 4 characters, or up until white space?
Do the baud rates from the RFID reader and PIC board need to match?
Thank you all very much in advance... |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1933 Location: Norman, OK
|
|
Posted: Wed Apr 08, 2009 6:49 pm |
|
|
The answers to your questions:
1. Gets willl not return until it receives CR (13).
2. The best approach is to use getc() and save each character, then start checking for a string match after the 4th char is received. (you might use the strstr() function)
3. Yes, the baud rate, # chars, parity, stop bits etc all must match. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|