//Title :CD interfacing with pic16f877a
//LCD module connections
sbit LCD_RS at RC0_bit; //LCD reset
sbit LCD_EN at RC1_bit; //LCD enable
sbit LCD_D4 at RC2_bit; //Data
sbit LCD_D5 at RC3_bit; //Data
sbit LCD_D6 at RC4_bit; //Data
sbit LCD_D7 at RC5_bit; //Data
//LCD Pin Direction
sbit LCD_RS_direction at TRISC0_bit;
sbit LCD_EN_direction at TRISC1_bit;
sbit LCD_D4_direction at TRISC2_bit;
sbit LCD_D5_direction at TRISC3_bit;
sbit LCD_D6_direction at TRISC4_bit;
sbit LCD_D7_direction at TRISC5_bit;
void main() {
char j,i,rfid[13];
int sara=54321;
Lcd_Init();
Lcd_cmd(_LCD_CLEAR);
LCD_Cmd(_LCD_CURSOR_OFF);
Lcd_out(1,1,"Press your card :)");
UART1_Init(9600);
rfid[13]= '\0' ;
while(1)
{
if (UART1_Data_Ready())
{
for(i=0;i<6;)
{
if(UART1_Data_Ready())
{
rfid[i]=UART1_Read(); // read the received data,
i++;
}
}
if(sara == rfid[i])
{
Lcd_Cmd(_LCD_SECOND_ROW);
Lcd_Out_cp("Tag:");
for(i=0;i<6;){
Lcd_Chr_Cp(rfid[i]);
UART1_Write(rfid[i]);
i++;
delay_ms(1);
}}
else {
Lcd_Cmd(_LCD_SECOND_ROW);
Lcd_Out_cp("not correct");
delay_ms(1);
}
[ATTACH type="full"]169103[/ATTACH]
}
}
}