CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Sending 4-bits from RFID reader->hyperterminal->PIC18F

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
iamkennyk



Joined: 08 Apr 2009
Posts: 1

View user's profile Send private message

Sending 4-bits from RFID reader->hyperterminal->PIC18F
PostPosted: Wed Apr 08, 2009 6:10 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Apr 08, 2009 6:49 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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