thanks for your answer, but I really need more help ...I even don't know how to receive the data from it...I would make the buffer bigger.
I think 40Bytes are OK.
You have to readout the buffer before it will be overwritten.
When the buffersize is to small You'll loose data.
It depends how many other tasks your controller has to compute.
delay commands should be avoided.
// USART0 Receiver buffer
#define RX_BUFFER_SIZE0 80
unsigned char rx_wr_index0,rx_rd_index0,rx_counter0;
unsigned int rx_wr_index0,rx_rd_index0,rx_counter0;
// This flag is set on USART0 Receiver buffer overflow
// USART0 Receiver interrupt service routine
interrupt [USART0_RXC] void usart0_rx_isr(void)
if ((status & (FRAMING_ERROR | PARITY_ERROR | DATA_OVERRUN))==0)
if (++rx_wr_index0 == RX_BUFFER_SIZE0) rx_wr_index0=0;
if (++rx_counter0 == RX_BUFFER_SIZE0)
// Get a character from the USART0 Receiver buffer
if (++rx_rd_index0 == RX_BUFFER_SIZE0) rx_rd_index0=0;
// USART0 initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART0 Receiver: On
// USART0 Transmitter: On
// USART0 Mode: Asynchronous
// USART0 Baud rate: 38400
To read out more than one Byte You have to define a Buffer and search for an End Term.//Receive one Byte - This has to be in the Main Loop
//Receive Sensor Data
http://www.datasheet39.com/PDF/916937/RF01D-datasheet.htmlI'm not really shure what a RF01D is.
A 433MHz Receiver or an RFID Card reader.
Do You have any link to a Datasheet?
The Example works with 38400 Bit/s 8,N,1Then choose the comunication parameters.
The receive Routine works interupt driven.while(rx_counter0>0)
So I would prepare the datax variable for 15Bytes ( = 1 complete String + CR/LF + 0 +2 spacer )my tags contains 10 digits on their serial numbers
In Your last Post in the field OUTPUT DATA the two last bytes are 0x13 and 0x10.Where did they come from?
You get 10Bytes by the ID and 2Bytes Enter ( =0x13 + 0x10 ).one string equals to 12.5 bytes?
Yes Sir.you mean this one?
This would be in the Initialisation at top of main.ccan it be the main loop?
unsigned char datax;
In CodeVision i can't find anything about gets.gets(datax,15);
so this is how the RFID realizes when to finish reading, is there similar method for when to start reading?In Your last Post in the field OUTPUT DATA the two last bytes are 0x13 and 0x10.
you fantastically explained it , I really can't thank you for it.You get 10Bytes by the ID and 2Bytes Enter ( =0x13 + 0x10 ).
To use the string functions of "C" you had to insert a 0 as last Byte.
So You get 13Bytes. The additional 2Bytes are only for safety.
I guess I understand this variable , it saves the 15 bytes RFID sends (correct me if i'm wrong please)unsigned char datax; //Prepare a variable with 15 possible values you use as string
But I don't know what this variable works.unsigned char datapoint=0; //Prepare a variable that used as pointer and set it to 0
what do you mean? what's wrong with that code?What missing now is the trouble shooting.
I really appreciate and never forget your favor!void makestring(void)
datax[datapoint]=getchar(); //Get the next character
if ((datax[datapoint-2] == 0x13) && (datax[datapoint-1] == 0x10)) //End of string is reached?
datax[datapoint] = 0x00; //Insert the "C" String end
lcd_puts(*datax); //Any output routine could be insert here LCD, USART or something else.
datapoint = 0; //Set Pointer to 0 for next card
//In main loop in the section while(1) You have to insert
//Receive Data and generate a string
It adresses the place where the next character placed in the datax string.But I don't know what this variable works.
When an uncomplete string from the RF01D was received the datapoint pointer has the last value.what do you mean? what's wrong with that code?
I guess the RF01D generate a string at it's TX pin, when a ID Card is reachable.so this is how the RFID realizes when to finish reading, is there similar method for when to start reading?