sohailkhanonline
Joined: 06 Mar 2008 Posts: 35 Location: pakistan
|
need help with RFID module |
Posted: Thu Mar 13, 2008 1:59 am |
|
|
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
|
|
Posted: Fri Mar 14, 2008 12:09 am |
|
|
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. |
|