A. 基於單片機的電子密碼鎖設計 畢業論文
這里有 http://www.zytxs.com/web2/mj09b33489.html
畢業論文 基於單片機的電子密碼鎖設計
AT89S51|矩陣鍵盤|電子密碼鎖|畢業設計
文件格式:word
畢業論文 基於單片機的電子密碼鎖設計
論文正文共49頁。共19073個字元數(不計空格)。
如需下載,請點擊頁面最下方「下載地址 點擊下載」。
基於單片機的電子密碼鎖設計
摘 要
隨著人們對安全的重視和科技的發展,對日常生活中的安全保險器件的要求越來越高。為滿足人們對鎖的使用要求 ,增加其安全性 ,用密碼代替鑰匙的密碼鎖應運而生。電子鎖由於具有報警功能,保密性高,使用靈活性好,安全系數高,設計方法合理,簡單易行,成本低,符合住宅、辦公室用鎖要求 , 具有推廣價值。受到了廣大用戶的親睞。這種應用以單片機為核心 ,通過編程來實現整體基本功能和安全性要求設計。
系統將能完成開鎖、超時報警、超次鎖定、管理員解密、修改用戶密碼基本的密碼鎖的功能。能用PROTEL99SE繪制電路原理圖,並做出調試好基於單片機的電子密碼鎖的實物。
關鍵詞:AT89S51,矩陣鍵盤,電子密碼鎖
Microcontroller-based design of electronic locks
ABSTRACT
As people focus on security and technology development, life insurance for the safety devices in increasingly high demand. To meet people』s use of the lock request to increase their safety, replace the key with a password lock came into being. Electronic lock as an alarm, high secrecy, use good flexibility, high safety factor, design reasonable, simple, low cost, consistent with residential, office lock request is worth promoting. By the user pro-gaze. This application to SCM is the core of the overall program to achieve the basic functions and design safety requirements.
System will be able to complete the unlock, alarm out, and Ultra lock, decrypt administrator, modify the basic user password lock feature. Can PROTEL99SE circuit schematic drawing and make a good debugging MCU-based electronic code lock of the kind.
Key words: AT89S51, matrix keyboards, electronic lock
目 錄
第一章 緒論 1
1.1 引言 1
1.2 電子密碼鎖的研究現狀 1
1.3 課題研究方法 2
第二章 開發環境和開發工具 3
2.1 Protel 99se簡介 3
2.2 keil介紹 4
2.3 開發工具在系統中的作用 5
2.4 主要元器件介紹 5
2.4.1 主控晶元AT89S51 5
2.4.2 數碼管 7
2.4.3 掉電存儲模塊AT24c02 8
第三章 電子密碼鎖設計硬體部分 9
3.1 電子密碼鎖總原理圖 9
3.2 開鎖電路設計 9
3.3 按鍵電路設計 9
3.4 顯示電路設計 10
3.4 掉電存儲電路設計 12
3.5 電源電路設計 12
第四章 電子密碼鎖軟體部分 13
4.1主程序流程圖: 13
4.2鍵功能流程圖: 14
第五章 電子密碼鎖實物製作和調試過程 15
5.1 電路板製作中的問題和調試結果分析 15
5.2 製作好的實物的圖片 16
第六章 總結 20
設計總結 20
參考文獻 21
致 謝 22
附錄一 電子密碼鎖的電路圖 23
附錄二 電子密碼鎖3D截圖 24
附錄三 電子密碼鎖程序清單 24
B. 基於單片機電子密碼鎖設計~
以前我在網上找到過密碼鎖的源代碼,你可以找找。給你一個思路吧,先用7個埠做成3*4矩陣鍵盤,0~9 * #共12個鍵,另外用4個埠做紅燈輸出、綠燈輸出、報警輸出、開鎖輸出。*鍵為取消鍵,#鍵為確認鍵,密碼可存入單片機的ROM中(不能改密碼)或存入24CXX串列E2PROM(可改密碼)。鍵盤處理方法可以用兩種,一種是在主程序里不停掃描埠檢測按鍵消抖動後處理按鍵。另一種方法是鍵盤通過與門接到外部中斷,當有鍵按下時會引起中斷,然後在中斷程序中消抖動後處理按鍵。經過鍵盤處理程序後就可以知道按下什麼鍵,是數字就存入你自己指定的密碼緩存寄存器,是取消就清除密碼緩存寄存器,是確認就讀出密碼與密碼緩存寄存器的值比較。密碼的存放(不加密8位數):設ABCD,4個位元組存放密碼,A中高4位與低4位各存入一位數,其它的跟A一樣。再就是用一個位元組的寄存器存放錯誤次數,錯一次加1,達到3次報警埠輸出信號,如果密碼正確就清零這個寄存器。
C. 51單片機關於密碼鎖的畢業設計,論文
程序設計內容
(1). 密碼的設定,在此程序中密碼是固定在程序存儲器ROM中,假設預設的密碼為「12345」共5位密碼。
(2). 密碼的輸入問題:由於採用兩個按鍵來完成密碼的輸入,那麼其中一個按鍵為功能鍵,另一個按鍵為數字鍵。在輸入過程中,首先輸入密碼的長度,接著根據密碼的長度輸入密碼的位數,直到所有長度的密碼都已經輸入完畢;或者輸入確認功能鍵之後,才能完成密碼的輸入過程。進入密碼的判斷比較處理狀態並給出相應的處理過程。
(3).按鍵禁止功能:初始化時,是允許按鍵輸入密碼,當有按鍵按下並開始進入按鍵識別狀態時,按鍵禁止功能被激活,但啟動的狀態在3次密碼輸入不正確的情況下發生的。
C語言源程序
#includeunsignedcharcodeps[]={1,2,3,4,5};
unsignedcharcodedispcode[]={0x3f,0x06,0x5b,0x4f,0x66,
0x6d,0x7d,0x07,0x7f,0x6f,0x00,0x40};
unsignedcharpslen=9;unsignedchartemplen;
unsignedchardigit;unsignedcharfuncount;
unsignedchardigitcount;
unsignedcharpsbuf[9];
bitcmpflag;
bithibitflag;
biterrorflag;
bitrightflag;
unsignedintsecond3;
unsignedintaa;
unsignedintbb;
bitalarmflag;
bitexchangeflag;
unsignedintcc;
unsignedintdd;
bitokflag;
unsignedcharoka;
unsignedcharokb;
voidmain(void)
{
unsignedchari,j;
P2=dispcode[digitcount];
TMOD=0x01;
TH0=(65536-500)/256;
TL0=(65536-500)%6;
TR0=1;
ET0=1;
EA=1;
while(1)
{
if(cmpflag==0)
{
if(P3_6==0)//functionkey
{
for(i=10;i>0;i--)
for(j=248;j>0;j--);
if(P3_6==0)
{
if(hibitflag==0)
{
funcount++;
if(funcount==pslen+2)
{
funcount=0;
cmpflag=1;
}
P1=dispcode[funcount];
}
else
{
second3=0;
}
while(P3_6==0);
}
}
if(P3_7==0)//digitkey
{
for(i=10;i>0;i--)
for(j=248;j>0;j--);
if(P3_7==0)
{
if(hibitflag==0)
{
digitcount++;
if(digitcount==10)
{
digitcount=0;
}
P2=dispcode[digitcount];
if(funcount==1)
{
pslen=digitcount;
templen=pslen;
}
elseif(funcount>1)
{
psbuf[funcount-2]=digitcount;
}
}
else
{
second3=0;
}
while(P3_7==0);
}
}
}
else
{
cmpflag=0;
for(i=0;i
{
if(ps[i]!=psbuf[i])
{
hibitflag=1;
i=pslen;
errorflag=1;
rightflag=0;
cmpflag=0;
second3=0;
gotoa;
}
}
cc=0;
errorflag=0;
rightflag=1;
hibitflag=0;
a: cmpflag=0;
}
}
}
voidt0(void)
interrupt1using0{ TH0=(65536-500)/256;
TL0=(65536-500)%6;
if((errorflag==1)&&(rightflag==0))
{
bb++;
if(bb==800)
{
bb=0;
alarmflag=~alarmflag;
}
if(alarmflag==1)
{
P0_0=~P0_0;
}
aa++;
if(aa==800)
{
aa=0;
P0_1=~P0_1;
}
second3++;
if(second3==6400)
{
second3=0;
hibitflag=0;
errorflag=0;
rightflag=0;
cmpflag=0;
P0_1=1;
alarmflag=0;
bb=0;
aa=0;
}
}
if((errorflag==0)&&(rightflag==1))
{
P0_1=0;
cc++;
if(cc<1000)
{
okflag=1;
}
elseif(cc<2000)
{
okflag=0;
}
else
{
errorflag=0;
rightflag=0;
hibitflag=0;
cmpflag=0;
P0_1=1;
cc=0;
oka=0;
okb=0;
okflag=0;
P0_0=1;
}
if(okflag==1)
{
oka++;
if(oka==2)
{
oka=0;
P0_0=~P0_0;
}
}
else
{
okb++;
if(okb==3)
{
okb=0;
P0_0=~P0_0;
}
}
}
}
D. 51單片機的電子密碼鎖程序,用KEIL C寫的
以前幫別人做過一個類似的
#include<reg52.h>
#include <def.h>
#include"lcd.c"
uchar key;
uchar num;
sbit alarm=P2^4;
sbit open=P2^1;
uchar code table[]={' ','1','2','3',
'4','5','6','7',
'8','9','0'};
void keyscan();
uchar hptable[10];
uchar password[6];
uchar wordbuf[6];
uchar fom[]="input password:";
uchar change[]="set mask:";
uchar state1[]="right";
uchar state2[]="error";
uchar sflag;
uchar dflag,cnt;
uchar setf,fset;
uchar flag;
void main ()
{
uchar hp;
alarm=0;
flag=0;
setf=0;
fset=0;
dflag=0;
lcden=0;
lcdrw=1;
lcdrs=1;
P3=0x0f;
for(hp=0;hp<6;hp++)
{
password[hp]='8';
}
write(0x38,0); //0為寫命令
delay(9);
write(0x08,0);
write(0x01,0);
write(0x06,0);
write(0x0c,0);
write(0x80,0);
for(hp=0;hp<15;hp++)
{
write(fom[hp],1);
}
while(1)
{
// alarm=!alarm;
keyscan();
if(setf==0)
{
if(num>=1&&num<=10)
{
write(0x80+0x40+cnt,0);
write('*',1);
wordbuf[cnt]=table[num];
cnt++;
num=0;
}
}
else
{
write(0x01,0);
write(0x80,0);
for(hp=0;hp<9;hp++)
{
write(change[hp],1);
}
fset=1;
cnt=0;
while(fset)
{
keyscan();
if(num>=1&&num<=10)
{
write(0x80+0x40+cnt,0);
write('*',1);
password[cnt]=table[num];
cnt++;
num=0;
}
if(num==11)
{
write(0x80+0x40+cnt-1,0);
write('