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 CCS Technical Support

need help with RFID module

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



Joined: 06 Mar 2008
Posts: 35
Location: pakistan

View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger

need help with RFID module
PostPosted: Thu Mar 13, 2008 1:59 am     Reply with quote

Ok I am using a PIC16F877A and PXMF-02SN reader which has an application when i connect it directly to COM1 of computer the 16 character is read in display console when i bring RFID card near to reader.
Now i want to receive this code at uC. Here is my code


#include<16f877a.h>
#fuses HS,NOWDT,NOLVP
#use delay (clock=20000000)
#use rs232(baud=9600,xmit=PIN_B5,rcv=PIN_B2,stream=CPU,parity=N,bits=8,stop=1)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,stream=RFID,parity=N,bits=8,stop=1)
#include<input.c>
//#include<stdlib.h>
#include<string.h>
/************ Declare variable*******************************/
char stringF[40]; //declaring a string to input data from card
char test[10]; //for test purpose only
/************ Main Functions ********************************/
void main()
{

strcpy(test,"Wait\n\r");

fprintf(CPU,test);
while(TRUE) {
fgets(stringF,RFID);
fprintf(CPU,stringf);

}
}

i get "Wait" at hyper terminal but no code . If i use get_string then how will i specify the stream (rs232) in its parameters other than default.
Is there any problem with the code and the character at which it terminates i don't know. Please help me!!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 14, 2008 12:09 am     Reply with quote

Add the ERRORS parameter to the #use rs232() statement for the RFID
stream. While you are transmitting "Wait" to the PC, you may be
getting characters from the RFID unit, which you are unable to process.
This will cause the hardware UART receiver to get an overrun error and
lockup. You can prevent the lockup by adding the ERRORS parameter.

Also, do you have a MAX232-type chip connected between pins C6 and
C7 on the PIC and the RFID unit ? You need one.
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