EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / I have some problem regarding RFID madule interfacing…..

I have some problem regarding RFID madule interfacing…..

|

Microcontroller › 8051 › I have some problem regarding RFID madule interfacing…..

  • This topic has 6 replies, 4 voices, and was last updated 11 years, 1 month ago by AJISH ALFRED.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • September 23, 2014 at 1:43 pm #3273
    Rahul Ray
    Participant

    Good evening Sir,i am trying to interface RFID module with 8051 microcontroller version-2 development board.My RFID tag number is FE00458C2413 which i got from hyper-terminal.But when i want to show that unique identification number in a 16×2 LCD through serial communication,there is some error occurs and also whenever i want to match the Id got from hyperterminal & lcd for the same tag,there is some mismatch happens.What can i do now?????Plz kindly suggest something how can i solve this problem???

    September 24, 2014 at 4:40 am #12224
    AJISH ALFRED
    Participant

    Suggest you to post your code and a snapshot of the working LCD to get better help.

    September 24, 2014 at 9:44 am #12226
    Rahul Ray
    Participant
    #include<reg51.h>
    #include<string.h>
    #include <intrins.h>
    #define cmdport P3
    #define dataport P2
    sbit rs = P3^0;        //register select pin
    sbit rw = P3^1;        //read write pin
    sbit  e = P3^2;     //enable pin
    sbit motor_pin = P0^7;
    unsigned int data_out,temp;
    unsigned char card_id[12];
    code unsigned char RFID_1[]=”FE00458C2413″;
    code unsigned char RFID_2[]=”4E007051B8D7″;
    void Delay(unsigned int);
    void Delay_servo(unsigned int);
    void recieve()     //Function to recieve data serialy from RS232 
    {
        unsigned char k;
         for(k=0;k<12;k++)
         { 
             while(RI==0); 
              card_id[k]=SBUF;
              RI=0;
        }
    }
    void delay(unsigned int msec)    //Function to provide time delay in msec.
    {
    int i,j;
    for(i=0;i<msec;i++)
    for(j=0;j<1275;j++);
    }
    //void Delay(unsigned int ms)
    //{
     // unsigned long int us = ms*1000;
      //while(us–)
     // {
       // _nop_();
      //}
    //}
     
    void Delay_servo(unsigned int us)
    {
      while(us–)
      {
        _nop_();
      }
    }
    void lcdcmd(unsigned char item)    //Function to send command to LCD
    {
    rs= 0;
    rw=0;
    e=1;
    dataport = item;
    delay(10);
    e=0;
    delay(10);
    }
    void lcddata(unsigned char iitem)    //Function to send data to LCD
    {
    rs= 1;
    rw=0;
    e=1;
    dataport = iitem;
    delay(10);
    e=0;
    delay(10);
    }
    void lcd_init()
    {
    lcdcmd(0x38);
    lcdcmd(0x0E);
    lcdcmd(0x01);
    }
    //void lcd_string(char add,char *str)
    void lcd_string(char *iitem)
    {
    int i;
    //lcdcmd(add);
    for(i=0;iitem!=’’;i++)
    {
    lcddata(iitem);
        }
    }
    void motor_forward()
    {
      motor_pin = 0;
     do
      { //Turn to 0 degree
        motor_pin = 1;
        Delay_servo(30);
        motor_pin = 0;
        delay(100);
       //Turn to 90 degree
        motor_pin=1;
        Delay_servo(62);
        motor_pin=0;
        delay(100);
        //Turn to 180 degree
        motor_pin=1;
        Delay_servo(110);
        motor_pin=0;
        delay(100);
      }while(1);
    }
    void main()
    {
        //unsigned char rec_data[12];
    int l=12,i;
        TMOD=0x20;            //Enable Timer 1
        TH1=0XFD;
        SCON=0x50;
        TR1=1;
    lcd_init();
    lcdcmd(0x80);
    lcd_string(“SWAP_THE_CARD:”);  // Triggering Timer 1
    delay(100);
    while(1)
        {
      recieve();
           lcdcmd(0xC1);        //Place cursor to second position of second line
             for(l=0;l<12;l++)
             { 
                  lcddata(card_id[l]);
     delay(1000);
             }
    i=0;
    while(1)
    {
    i=strcmp(RFID_1,card_id);
    if(i!=0)
    {
    lcdcmd(0x01);
    lcdcmd(0x0E);
    lcdcmd(0x80);
    //lcddata(“MOVE MOTOR”);
    lcd_string(“MOVE MOTOR”);
             motor_forward();
    }
    else
    {
    lcdcmd(0x01);
    lcdcmd(0x0E);
    lcdcmd(0x80);
    delay(100);
    //lcddata(“NO_MOVEMENT”);
    lcd_string(“NO MOVEMENT”);
    delay(1000);
    }
     }
      
    }
    }
         
    i here posted my code…………..due to the mismatching between RFID tag numbers,there is always showing the NO MOVEMENT of motor………………
    i already mentioned the rfid tag number from hyperterminal in the above.
     
     
     
     
     
     
     
    September 28, 2014 at 11:52 am #12235
    Ashutosh Bhatt
    Participant

    you will get RFID tag number as string of bytes from serial port.

    so you have to first store all these bytes in a array

    then just display all array characters one by one on LCD

    for matching RFID tag you have to do same

    make one array with same tag

    now read RFID tag and store all characters in another array

    compare elements of both array one by one.

    September 28, 2014 at 2:00 pm #12237
    Shailesh Kukna
    Participant

    See code of RFID based attendance system from this webside. It will helpful to you.

    September 29, 2014 at 5:07 am #12240
    AJISH ALFRED
    Participant

    Hi Rahul,

    Does your RFID display anything else properly or there is issue with the card number only? I’m concerned about the delay function which your are using, it can happen that the compiler can sometimes optimize the loop and produce no delay at all, which can cause issues in the LCD display.

    September 29, 2014 at 5:12 am #12241
    AJISH ALFRED
    Participant

    Also try these modifications,

     

    Change the declaration of card_id array to,

     

    unsigned char card_id[13];
     
    and add one more line inside tne function,
     
    void recieve()     //Function to recieve data serialy from RS232 
    {
        unsigned char k;
         for(k=0;k<12;k++)
         { 
             while(RI==0); 
              card_id[k]=SBUF;
              RI=0;
        }
     
       card_id[13]=’’;
    }
  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • need help in photodetection TIA circuit November 18, 2025
  • Anyone In The US Ordered From AliExpress Recently? November 17, 2025
  • Measuring controller current output with a meter November 17, 2025
  • Can a small solar panel safely trickle-charge old NiMH AA batteries? November 17, 2025
  • Have a ultrasonic washer but not knowing what detergent for cleaning soot November 17, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise