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 / interfacing fingerprint module r305 with p89v51rd2 controller

interfacing fingerprint module r305 with p89v51rd2 controller

|

Microcontroller › 8051 › interfacing fingerprint module r305 with p89v51rd2 controller

  • This topic has 1 reply, 2 voices, and was last updated 11 years, 10 months ago by Flake.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • January 16, 2014 at 1:30 pm #2813
    shailav surve
    Participant

    Hello Sir,

                 I have the following code for interfacing fingerprint module with microcontroller..But this code is for interfacing Sm630 with microcontroller but i am using r305..so please tell me that will this code run with r305 fingerprint module??

                 The code is as follows..

                 #define cmd_add_fingerprint     0x40

    #define cmd_search_fingerprint 0x44
    #define cmd_packet      0x10
    #define data_packet     0x20
    #define res_packet      0x30

    #define res_rcv_correct 0x01
    #define res_rcv_error   0x02
    #define res_opr_success 0x31
    #define res_finger_detected     0x32
    #define res_timeout     0x33
    #define res_process_fail 0x34
    #define res_para_error  0x35
    #define res_fingerprint_found 0x39
    #define res_fingerprint_unfound 0x3A

    #use rs232(baud=57600,xmit=PIN_C6,rcv=PIN_C7,bits=8,parity=n,stop=1,stream=Finger,timeout=1000)//,force_sw)

    int8 cmd_buffer[10],response_buffer[15];

    int8 find_checksum(int8 total_byte)
    {
            int8 byte_count;
            int16 check_sum=0;
            for(byte_count=0;byte_count<total_byte;byte_count++)
            {
                    check_sum+=cmd_buffer[byte_count];
            }
            
            return(make8(check_sum,0));
    }

    void cmd_to_sm630(int8 total_byte)
    {
            int8 byte_count;
            for(byte_count=0;byte_count<total_byte;byte_count++)
            {
                    fputc(cmd_buffer[byte_count],Finger);
                    delay_us(10);
            }               
    }

    void response_from_sm630(int8 total_byte)
    {
            int8 byte_count;
            while(fgetc(Finger)!=0x4D);
            response_buffer[0]=0x4D;
            for(byte_count=1;byte_count<total_byte;byte_count++)
            {
                    response_buffer[byte_count]=fgetc(Finger);
            }                       
    }               
            

    int8 add_finger(int16 finger_id)
    {
            cmd_buffer[0]=0x4D; //Packet Head
            cmd_buffer[1]=0x58; //Packet Head
            cmd_buffer[2]=cmd_packet; //Command Packet
            cmd_buffer[3]=0x03; //3 byte length
            cmd_buffer[4]=cmd_add_fingerprint; //Add finger Print cmd
            cmd_buffer[5]=make8(finger_id,1);//Higher byte of finger print id
            cmd_buffer[6]=make8(finger_id,0);//Lower byte of finger print id
            cmd_buffer[7]=find_checksum(7);//Check sum of 7 bytes
            
            cmd_to_sm630(8);
            response_from_sm630(6); //Read 6 bytes
            
            if(response_buffer[4] == res_rcv_correct)
            {
                    
                    response_from_sm630(7); //Read 6 bytes
                    if(response_buffer[5] == res_opr_success)
                    {
                            //Display Press finger again
                            //lcd_goto(2,1);
                            //lcd_send_byte(”  Press again   “);
                            response_from_sm630(7); //Read 6 bytes
                    }
            }
            return (response_buffer[5]);            
    }       

    int8 search_finger(int16& result_id,int16 num_fingerprint)
    {
            output_low(PIN_A5);
            cmd_buffer[0]=0x4D; //Packet Head
            cmd_buffer[1]=0x58; //Packet Head
            cmd_buffer[2]=cmd_packet; //Command Packet
            cmd_buffer[3]=0x05; //5 byte length
            cmd_buffer[4]=cmd_search_fingerprint; //Search finger Print cmd
            cmd_buffer[5]=0x00; //Higher byte of Starting id
            cmd_buffer[6]=0x00; //Lower byte of Starting id
            cmd_buffer[7]=make8(num_fingerprint,1);//Higher byte of number of  fingerprints searched
            cmd_buffer[8]=make8(num_fingerprint,0);//Lower byte of number of  fingerprints searched
            cmd_buffer[9]=find_checksum(9);//Check sum of 9 bytes
            
            cmd_to_sm630(10);
            response_from_sm630(6); //Read 6 bytes
            if(response_buffer[4] == res_rcv_correct)
            {
                    response_from_sm630(7); //Read 7 bytes
                    if(response_buffer[5] == res_opr_success)
                    {
                                    delay_ms(10);
                                    response_from_sm630(6); //Read 6 bytes
                                    //disp_response(6);
                                    if(response_buffer[5] ==res_fingerprint_found)
                                    {
                                            response_buffer[0]=fgetc(Finger);
                                            response_buffer[1]=fgetc(Finger);
                                            result_id=make16(response_buffer[0],response_buffer[1]);
                                    }
                    
            
                    }

            }
            else
                    response_buffer[5]=response_buffer[4];          
            return (response_buffer[5]);    
                    

    }      

     

     

    January 24, 2014 at 6:39 am #10879
    Flake
    Participant

    A teacher, or the prison, more and more ares are considering the legal use of cell phone jammers, it has been a necessity of our daily life, I have got mobile phone jammers for my family. so if you want to get one, you can go and visit it for more details. share with you!
     

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • mechanism to shutdown feeding when sensor temperature rises December 13, 2025
  • Oshonsoft MSSP simulation question December 13, 2025
  • Droplet1 December 13, 2025
  • What is involved to convert a small town to fiber optic? December 13, 2025
  • Measuring controller current output with a meter December 13, 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