1. Circuit Design
This circuit consists of a minimum system board, LCD1602 liquid crystal module and AS608 fingerprint module.
2. Operation Effect
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
}
}
}
Previous article:51 MCU game (snake)
Next article:Single chip design of ultrasonic distance measurement simulation
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- [ART-Pi Review] VI: Review of ATT-Pi's onboard Flash file system and FTP functions in RTT Studio environment
- Use transistor + MOS tube to control battery output
- Contemporary IoT smart antenna design trends | Review TE's exciting live broadcast, write a comment and win a gift!
- VLSI Digital Signal Processing Systems: Design and Implementation
- A foreign guy pranked: using ESP32 microcontroller disguised as GPU to infect his friend's computer with "ransomware"
- 13 Rules You Must Read for RF Circuit Power Supply Design
- Agilent6684A power supply maintenance method - Antai Instrument Maintenance
- General frequency converter technology of DSP
- Comparison table of domestic 32-bit MCU and ST, GD compatible models
- Foxconn insider steals iPhone parts and resells them for 300 million yuan, alarming Cook, Apple is investigating