abdo.medo1000
Member level 1
Dear all,
I'm trying to make an Door Security System Using RFID with LCD using pic16f877A. I was trying to defined my ID tag number on the code in MicroC program but it is not working on my simulation , I want to save some ID tags number like ( x=12345// john's card , y=54321// Sara's card) as a variable and when RFID reader read them it should show tag and the cards number which meaning the the entering is approved and if else it will say "it not correct" . Now i rote the code to do that but im not taking what i want im lookng forward of your helping
Here is my code
I'm trying to make an Door Security System Using RFID with LCD using pic16f877A. I was trying to defined my ID tag number on the code in MicroC program but it is not working on my simulation , I want to save some ID tags number like ( x=12345// john's card , y=54321// Sara's card) as a variable and when RFID reader read them it should show tag and the cards number which meaning the the entering is approved and if else it will say "it not correct" . Now i rote the code to do that but im not taking what i want im lookng forward of your helping
Here is my code
Code:
//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]
}
}
}
Attachments
Last edited: