Connect with us

EM-18 rfid reader module with pic microcontroller

Discussion in 'Microcontrollers, Programming and IoT' started by Sajo Joseph, Nov 17, 2014.

  1. Sajo Joseph

    Sajo Joseph

    5
    1
    Nov 17, 2014
    how to interface em-18 rfid reader module with pic 16f877a microcontroller ?
     
  2. Harald Kapp

    Harald Kapp Moderator Moderator

    9,375
    1,906
    Nov 17, 2011
    Welcome to our forum.

    The datasheet is not worth its name. I guess by connecting pin 6 to High you activate RS232 mode and can then read data from pin 7 via UART protocol (5V logic level, not true RS232 level!) This setup is shown here.
     
    Sajo Joseph likes this.
  3. ligo.george

    ligo.george

    12
    4
    Feb 2, 2013
    Circuit Diagram :
    [​IMG]
    MikroC Code :
    Code:
    // LCD module connections
    sbit LCD_RS at RB2_bit;
    sbit LCD_EN at RB3_bit;
    sbit LCD_D4 at RB4_bit;
    sbit LCD_D5 at RB5_bit;
    sbit LCD_D6 at RB6_bit;
    sbit LCD_D7 at RB7_bit;
    
    sbit LCD_RS_Direction at TRISB2_bit;
    sbit LCD_EN_Direction at TRISB3_bit;
    sbit LCD_D4_Direction at TRISB4_bit;
    sbit LCD_D5_Direction at TRISB5_bit;
    sbit LCD_D6_Direction at TRISB6_bit;
    sbit LCD_D7_Direction at TRISB7_bit;
    // End LCD module connections
    
    void main()
    {
    char i, rfid[13];
    Lcd_Init(); // Initialize LCD
    Lcd_Cmd(_LCD_CLEAR); // Clear display
    Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
    Lcd_Out(1,1,"RFID Tag Reader"); // Write text in first row
    
    UART1_Init(9600); // Initialize UART, 9600 baud rate
    
    rfid[12] = ''; // String Terminating Character
    
    while(1) // Infinite Loop
    {
    if(UART1_Data_Ready()) // If UART Data Ready
    {
    for(i=0;i<12;) // To Read 12 characters
    {
    if(UART1_Data_Ready())
    {
    rfid[i] = UART1_Read();
    i++;
    }
    }
    // Check For Errors
    if((rfid[0] ^ rfid[2] ^ rfid[4] ^ rfid[6] ^ rfid[8] == rfid[10]) && (rfid[1] ^ rfid[3] ^ rfid[5] ^ rfid[7] ^ rfid[9] == rfid[11]))
    {
    Lcd_Out(2,1,rfid);
    }
    else
    {
    Lcd_Out(2,1,"Error ");
    }
    }
    }
    
    Source :
    Interfacing EM-18 RFID Reader Module with PIC Microcontroller
     
    Sajo Joseph likes this.
  4. kumarmanoj0129

    kumarmanoj0129

    1
    0
    Oct 14, 2015
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-