Okay sorry for the delay but Ive finally got all my problems down to just reading in the bytes. So what I want it to do right now is store the tag number and then display it on my 20x4 lcd screen. Here is my code im using which just prints garbage to the screen. I think that Im not reading in the bytes correctly so the garbage is the random data from the blank array.
Any ideas?
Thanks in advance
update: also, ive hooked up TX from the ID-20 to my oscilloscope and it is outputing serial data when a card is read
#include "hardware.h"
// Initialise the hardware
void appInitHardware(void) {
initHardware();
}
// Initialise the software
TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
// -------- Start Sparkfun serLCD-------
//turn on LCD
pin_high(LCD_Relay);
delay_ms(300);
rprintfInit( displayGetWriter(&LCD));
displayBacklight(&LCD,TRUE);
// -------- End Sparkfun serLCD-------
return 0;
}
// This is the main loop
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart) {
//////////Main Loop/////////////////////////////////////////
char tagString[13];
int index=0;
boolean reading = false;
//read from rfid
while(uartGetByte(ID20)!=-1){//do while data recieved non -1 data
int readByte=uartGetByte(ID20);//Assign byte read to a temp int
if(readByte == 2) reading = true; //begining of tag
if(readByte == 3) reading = false; //end of tag
if(reading && readByte != 2 && readByte != 10 && readByte != 13){//store the tag
tagString[index] = readByte;
index ++;
}
}
//display data
for (int i=0;i<12;i++){//display data along collumns
displayGoto(&LCD,i,0);//display position
rprintf("%c",tagString[i]);
}
//clear screen
delay_ms(1000);
displayClear(&LCD);
return 0;
}