Mrunal Ahirrao
Full Member level 2
- Joined
- Nov 26, 2012
- Messages
- 133
- Helped
- 2
- Reputation
- 4
- Reaction score
- 2
- Trophy points
- 1,298
- Location
- India
- Activity points
- 2,213
Hi all,
I am trying to interface RFID reader with PIC16F628A using UART but it doesn't work. I tried using MikroC libraries but failed, so I tried by manual declaring all registers associated with USART. But it again failed. Any help would be appreciated.
The LED should lit but it doesn't!
I am trying to interface RFID reader with PIC16F628A using UART but it doesn't work. I tried using MikroC libraries but failed, so I tried by manual declaring all registers associated with USART. But it again failed. Any help would be appreciated.
Code:
sbit LED at RB3_bit;
unsigned char rdata[12];
unsigned char idata[]="84008159124E";
unsigned short i;
void interrupt()
{
if(PIR1.RCIF==1)
{
rdata[i]=RCREG;
i++;
}
}
void main()
{
CMCON = 7; // Disable Comparators
TRISB = 0b00000110;
SPBRG=25; // Fill SPBRG register to set the baud rate
RCSTA.SPEN=1; // To activate serial port (Tx and Rx pins)
RCSTA.CREN=1; // To enable continuous reception
PIE1.RCIE=1; // To enable the Reception (Rx) Interrupt
INTCON.GIE=1;
INTCON.PEIE=1;
TXSTA.BRGH=1;
TXSTA.SYNC=0;
do{
if(rdata==idata)
{
LED=1;
}
}while(1);
}
The LED should lit but it doesn't!