RFID IN MIKROC

Photo of author

By Jackson Taylor

char cardletter;
void lcdstart(void);
void card1(void);
void card2(void);
void card3(void);
void rfid(void);
// LCD module connections
sbit LCD_RS at RD2_bit;
sbit LCD_EN at RD3_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_RS_Direction at TRISD2_bit;
sbit LCD_EN_Direction at TRISD3_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
// End LCD module connections
void main(){
  uart1_init(9600);
  Delay_ms(100);                  // Wait for UART module to stabilize
lcdstart();
  while(1)
  {
  rfid();
  }
}
void rfid(void)
{
  if (UART1_Data_Ready())
   {
cardletter = UART1_Read();
card1();
card2();
card3();
}
}
 void card1(void)//card no.1000699A58BB(PRINTED NO.10539512)
{
if(cardletter==’8′)
{
while(!(UART1_Data_Ready()));
cardletter = UART1_Read();
if(cardletter==’B’)
{Lcd_Out(2,1,”card found 1″);}
}
}
 void card2(void)//card no.180089205DEC (PRINTED NO.13708285)
{
if(cardletter==’D’)
{
while(!(UART1_Data_Ready()));
cardletter = UART1_Read();
if(cardletter==’E’)
{Lcd_Out(2,1,”card found 2″);}
}
}
 void card3(void)//card no.1800893719BF (PRINTED NO.13714105)
{
if(cardletter==’9′)
{
while(!(UART1_Data_Ready()));
cardletter = UART1_Read();
if(cardletter==’B’)
{Lcd_Out(2,1,”card found 3″);}
}
}
 void lcdstart(void)
 {
    Lcd_Init();                        // Initialize LCD
  Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off
   Lcd_Out(1,6,”Alchol detector”);
   delay_ms(1000);
     Lcd_Cmd(_LCD_CLEAR);
 }