目录
一、项目功能
二、视频
三、原理图
4、材料选择
5、部分程序
资料下载地址:基于STM32的多功能门禁系统
一、项目功能
1、AS608指纹解锁;可以录入、删除、验证指纹;
2、密码解锁;可以密码验证、修改密码和保存密码;
3、刷卡解锁;
4、OLED液晶显示;
二、视频
基于STM32的多功能门禁系统(AS608指纹识别、密码解锁、刷卡解锁)
三、原理图
4、材料选择
AS608指纹模块
RC522刷卡模块
OLED液晶显示模块
矩阵按键模块文章来源:https://www.toymoban.com/news/detail-517224.html
文章来源地址https://www.toymoban.com/news/detail-517224.html
5、部分程序
#include "sys.h"
#include "delay.h"
#include "oled_iic.h"
#include "stdio.h"
#include "key.h"
#include "timer.h"
#include "as608.h"
#include "usart3.h"
#include "stmflash.h"
#include "key_driver.h"
#include "RFID_RC522.h"
//要写入到STM32 FLASH的字符串数组
u8 TEXT_Buffer[10]={"1234"};
#define SIZE sizeof(TEXT_Buffer) //数组长度
u8 datatemp[SIZE];
u8 PassFlag = 0;// 1 :更改密码 2:验证密码
u8 inputidx = 0;
u8 setidx = 0;
u8 cardidx = 0;
u8 delidx = 0;
u16 errcnts = 0;
int main(void)
{
extern const u8 BMP1[];
int i = 0,m = 0,temp = 0;
u8 data[16]={0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x20,255,255,255,255,255,255,255}; //写入的金额;
HZ= GB16_NUM();
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//设置中断优先级分组为组2:2位抢占优先级,2位响应优先级
delay_init();
TIM3_Int_Init(71,999);
Init_Key_Driver();
usart3_init(57600);
KEY_Init();
delay_ms(100);
OLED_Init();
//delay_ms(1000);
OLED_Clear();
//delay_ms(500);
OLED_ShowCH(16, 0, "指纹解锁");
OLED_ShowCH(16, 2, "K1添加指纹");
OLED_ShowCH(16, 4, "K3删除指纹");
OLED_ShowCH(16, 6, "K5验证指纹");
STMFLASH_Read(FLASH_SAVE_ADDR,(u16*)TEXT_Buffer,4);//获取密码
delay_ms(50);
RC522_Init(); //RC522
while(1)
{
Main_Key_Ack();
if(SysMenu.menuidx == 0)
{
if(SysMenu.ID == 0)
{
OLED_ShowCH(16, 0, "指纹解锁");
OLED_ShowCH(16, 2, "K1添加指纹");
OLED_ShowCH(16, 4, "K3删除指纹");
OLED_ShowCH(16, 6, "K5验证指纹");
}
PassFlag = 0;
if(SysMenu.ID==1)
{
OLED_Clear();
//
Add_FR();
}
if(SysMenu.ID==3)
{
OLED_Clear();
Del_FR();
}
if(SysMenu.ID==5)
{
OLED_Clear();
OLED_ShowCH(32,2,"请按手指");
press_FR();
}
}
else if(SysMenu.menuidx == 1)
{
if(SysMenu.ID == 0)
{
OLED_ShowCH(16, 0, "密码解锁");
OLED_ShowCH(16, 2, "K1更改密码");
OLED_ShowCH(16, 4, "K2验证密码");
//Main_Key_Ack();
}
if(SysMenu.ID == 1)
{
switch(setidx)
{
case 0://输入新密码
Syspass.flag = 1;
OLED_ShowCH(16, 2, "输入新密码");
OLED_ShowCH(16, 4, " ");
setidx = 1;
break;
case 1://显示****
for( i = 0 ; i < Syspass.changenum;i++)
{
OLED_ShowCH(16 + i *16, 4, "*");
}
if(Syspass.changenum == 4)
setidx = 2;
break;
case 2://密码更改
if(Syspass.isok == 1)
{
Syspass.isok = 0;
ChangePass();
delay_ms(1000);
setidx = 0;
SysMenu.ID = 0;
Syspass.flag = 0;
}
break;
}
}
if(SysMenu.ID == 2)
{
switch(inputidx)
{
case 0://输入密码
Syspass.flag = 2;
OLED_ShowCH(16, 2, "请输入密码");
OLED_ShowCH(16, 4, " ");
inputidx = 1;
break;
case 1://显示****
for( i = 0 ; i < Syspass.verifynum;i++)
{
OLED_ShowCH(16 + i *16, 4, "*");
}
if(Syspass.verifynum == 4)
inputidx = 2;
break;
case 2://密码匹配
if(Syspass.isok == 1)
{
Syspass.isok = 0;
MatchPass();
delay_ms(1000);
inputidx = 0;
SysMenu.ID = 0;
Syspass.flag = 0;
}
break;
}
}
}
else if(SysMenu.menuidx == 2)
{
if(SysMenu.ID == 0)
{
OLED_ShowCH(16, 0, "刷卡解锁");
OLED_ShowCH(16, 2, "K1请刷卡");
//OLED_ShowCH(16, 4, "K2验证密码");
}
if(SysMenu.ID == 1)
{
switch (cardidx)
{
case 0:
OLED_ShowCH(16, 2, "请刷卡 ");
//OLED_ShowCH(16, 4, " ");
temp = read_card_data();
if(temp == 0)
{
cardidx = 1;
}
else
OLED_ShowCH(16, 4, " ");
errcnts++;
if(errcnts > 200)
{
errcnts = 0;
cardidx = 0;
SysMenu.ID = 0;
OLED_ShowCH(16, 4, " ");
}
break;
case 1:
OLED_ShowCH(16, 4, "刷卡成功");
delay_ms(1500);
delay_ms(1500);
cardidx = 0;
SysMenu.ID = 0;
OLED_ShowCH(16, 4, " ");
break;
case 2:
break;
}
}
}
}
}
到了这里,关于基于STM32的多功能门禁系统(AS608指纹识别、密码解锁、刷卡解锁)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!