PIC: PIC C18F4520
Compiler: HiTec C18
Programmer: Microchip MPLAB ICD2
Hey, i'm really new to PIC's etc so if i make stupid mistakes please forgive me.
I'm building a RFID scanning system using a ID-12 Reader. When a RFID is scanned, it is read through the USART Rx pin, where it is picked up by an interrupt.
My main method loops waiting for GET_DATA to go high. When it does it launches the following code.
My issue is that when the array inputString[] is outputted to hyper terminal, I receive no tag. However, If i remove all the checks etc, and leave a bare bones code such as
inputString[] gets the full RFID Tag.
Can someone help me figure out whats wrong please?
Compiler: HiTec C18
Programmer: Microchip MPLAB ICD2
Hey, i'm really new to PIC's etc so if i make stupid mistakes please forgive me.
I'm building a RFID scanning system using a ID-12 Reader. When a RFID is scanned, it is read through the USART Rx pin, where it is picked up by an interrupt.
Code:
#pragma interrupt_level 0
static void interrupt isr(void)
{
if((RCIE)&&(RCIF))
{
while(PROCESSING);
DATA=RCREG;
GET_DATA=1;
}
}
My main method loops waiting for GET_DATA to go high. When it does it launches the following code.
Code:
if(GET_DATA)
{
PROCESSING = 1;
if(DATA == 02) {
received = 1;
i=0;
}
else
{
if(DATA != 02)
{
inputString[i]= DATA;
Led1=!Led1;
i++;
}
}
GET_DATA = 0;
PROCESSING = 0;
}
My issue is that when the array inputString[] is outputted to hyper terminal, I receive no tag. However, If i remove all the checks etc, and leave a bare bones code such as
Code:
if(GET_DATA)
inputString[i]=DATA;
i++;
inputString[] gets the full RFID Tag.
Can someone help me figure out whats wrong please?