Design of Fingerprint Recognition System Based on Single Chip Microcomputer

Publisher:疯狂小马Latest update time:2022-08-24 Source: csdnKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Circuit Design

This circuit consists of a minimum system board, LCD1602 liquid crystal module and AS608 fingerprint module.


2. Operation Effect

insert image description here
insert image description here

3. Main Code


/*Want more projects private wo!!!*/

#include "sys.h"

#include "delay.h"

#include "usart.h"

#include "lcd.h"

#include "key.h"

#include "touch.h"   

#include "malloc.h" 

#include "usmart.h"  

#include "MMC_SD.h"   

#include "ff.h"  

#include "exfuns.h"    

#include "fontupd.h"

#include "text.h"

#include "usart2.h"

#include "AS608.h"

#include "timer.h"


#define usart2_baund 57600 //Serial port 2 baud rate, change according to the baud rate of the fingerprint module


SysPara AS608Para; //Fingerprint module AS608 parameters

u16 ValidN; //Number of valid templates in the module

u8** kbd_tbl;

const u8* kbd_menu[15]={"del_fp"," : ","add_fp","1","2","3","4","5","6","7","8","9","DEL","0","Enter",}; //Key table

const u8* kbd_delFR[15]={"BACK"," : ","del_all","1","2","3","4","5","6","7","8","9","DEL","0","Enter",}; //Key table


void Add_FR(void); //Record fingerprint

void Del_FR(void); //Delete fingerprint

void press_FR(void);//Swipe fingerprint

void ShowErrMessage(u8 ensure);//Display confirmation code error message

void AS608_load_keyboard(u16 x,u16 y,u8 **kbtbl); //load virtual keyboard

u8 AS608_get_keynum(u16 x,u16 y);//Get the keyboard number

u16 GET_NUM(void); //Get the value  


int main(void)

{  

u8 ensure;

u8 key_num;

char *str;


  Stm32_Clock_Init(9); //System clock settings

delay_init(72);   //delay initialization

uart_init(72,115200); //Serial port 1 initialization, used to support USMART    

LCD_Init(); //Initialize LCD 

KEY_Init(); //Key initialization       

usmart_dev.init(72); //initialize usmart

  usart2_init(36,usart2_baund); //Initialize serial port 2 for communication with fingerprint module

PS_StaGPIO_Init();   //Initialize FR read status pin

tp_dev.init(); //Touch screen initialization

  mem_init(); //Initialize memory pool     

  exfuns_init(); //Apply for memory for fatfs related variables  

  f_mount(fs[1],"1:",1); //Mount FLASH.

POINT_COLOR=RED;

while(font_init()) //Check font library

{     

LCD_ShowString(60,50,240,16,16,"Font Error!");

delay_ms(200);   

LCD_Fill(60,50,240,66,WHITE); //Clear display

delay_ms(200);

}

if(!(tp_dev.touchtype&0x80))//If it is a resistive screen

{

Show_Str_Mid(0,30,"Adjust the touch screen?",16,240);

POINT_COLOR=BLUE;

Show_Str_Mid(0,60,"YES: KEY1 NO: KEY0",16,240);

while(1)

{

key_num=KEY_Scan(0);

if(key_num==KEY0_PRES)

break;

if(key_num==KEY1_PRES)

{

LCD_Clear(WHITE);

TP_Adjust();  //Screen calibration 

TP_Save_Adjdata(); //Save calibration parameters

break;

}

}

}

/*Load fingerprint recognition experiment interface*/

LCD_Clear(WHITE);

POINT_COLOR=RED;

Show_Str_Mid(0,0,"AS608 Fingerprint module test",16,240);          

Show_Str_Mid(0,20,"Author: @ALIENTEK",16,240);      

  POINT_COLOR=BLUE;

Show_Str_Mid(0,40,"Connect with AS608....",16,240);

while(PS_HandShake(&AS608Addr)) //Handshake with AS608 module

{

LCD_Fill(0,40,240,80,WHITE);

Show_Str_Mid(0,40,"Cannot connect with AS608!",16,240);

delay_ms(1000);

LCD_Fill(0,40,240,80,WHITE);

Show_Str_Mid(0,40,"Try to connect again....",16,240);

delay_ms(1000);   

}

LCD_Fill(0,40,240,320,WHITE);

Show_Str_Mid(0,40,"Connect success!",16,240);//Communication successful

str = mymalloc(30);

sprintf(str,"Baudrate:%d Addr:%x",usart2_baund,AS608Addr);//Display baud rate

Show_Str(0,60,240,16,(u8*)str,16,0);

delay_ms(100);

ensure=PS_ValidTempleteNum(&ValidN); //Read the number of fingerprints in the library

if(ensure!=0x00)

ShowErrMessage(ensure); //Show confirmation code error message

ensure=PS_ReadSysPara(&AS608Para); //Read AS608 module parameters 

if(ensure==0x00)

{

mymemset(str,0,50);

sprintf(str,"RemainNum:%d Level:%d",AS608Para.PS_max-ValidN,AS608Para.PS_level); //Display the number of remaining fingerprints and security level

Show_Str(0,80,240,16,(u8*)str,16,0);

}

else

ShowErrMessage(ensure);

myfree(str);

AS608_load_keyboard(0,170,(u8**)kbd_menu); //Load virtual keyboard

while(1)

{

key_num=AS608_get_keynum(0,170);

if(key_num)

{

if(key_num==1)Del_FR(); //delete fingerprint

if(key_num==3)Add_FR(); //Record fingerprint

}

if(PS_Sta) //Check PS_Sta status, if a finger is pressed

{

press_FR(); //Swipe fingerprint

}  

}

}

Keywords:MCU Reference address:Design of Fingerprint Recognition System Based on Single Chip Microcomputer

Previous article:51 MCU game (snake)
Next article:Single chip design of ultrasonic distance measurement simulation

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号