【正文】
壽命長。其特點如下: 1) 保密性好,編碼量多,遠遠大于彈子鎖。 With the continuous development of science and technology, in the daily lives of people on insurance safety devices increasingly demanding. To meet the requirements of the use of locks to increase their security, with a password instead of the password key lock came into being. Password lock is safe, low cost, low power consumption, easy to operate, Remember the password to unlock it , and other advantages. At present the use of electronic locks are mostly based on microprocessor, main devices MCU, the encoder and decoder built into software. SCM system from the system( Mainly AT89C51 microcontroller minimum 3 system) , 44 Matrix keyboard, LCD display and alarm system, With the settings, modify the six user password, Ultra alarm, Ultra Lock, Password error alarm and other functions(P0 port to control the design of the LCD display, Password correctly display password ok! Password error display password error! For more than three times to enter the error automatically lock. The P1 port control keyboard matrix containing the number keys 09 and AF function keys). In addition to the above basic password lock feature, based on the actual situation can also add a remote control functions. The system costeffective, practical function. The system costeffective, practical function Key words AT89C51 1602LCD Electronic password lock 44 keyboard 4 目錄 摘要 ................................................................................................................................. 2 第一章 緒論 .................................................................................................................... 5 電子密碼鎖簡介 ............................................................................................. 5 本設(shè)計所要實現(xiàn)的目標(biāo) ...................................................................................... 5 設(shè)計方案簡介 .................................................................................................. 5 第二章 硬件電路設(shè)計 ................................................................................................... 6 設(shè)計原理 ............................................................................................................. 6 總體電路圖 .......................................................................................................... 6 鍵盤電路 ........................................................................................................... 7 顯示器電路 ......................................................................................................... 8 報警電路 ........................................................................................................... 8 密碼存儲電路 .................................................................................................. 9 單片機電路 ....................................................................................................... 10 第三章 系統(tǒng)軟硬件設(shè)置及調(diào)試 .......................................................................................11 Keil c51 簡介 .................................................................................................11 程序源代碼 ................................................................................................... 12 調(diào)試過程 ....................................................................................................... 18 Proteus 仿真 ................................................................................................... 19 第四章 主要元器件介紹 ............................................................................................... 19 主控芯片 AT89C51 ............................................................................................ 19 存儲芯片 24C04A .............................................................................................. 22 結(jié)論與展望 .................................................................................................................... 22 致謝 ............................................................................................................................... 23 參考文獻 ........................................................................................................................ 24 5 第一章 緒論 電子密碼鎖簡介 電子密碼鎖是一種通過密碼輸入來控制電路或是芯片工作,從而控制機械開關(guān)的閉合,完成開鎖、閉鎖任務(wù)的電子產(chǎn)品。當(dāng)輸入 0~9 的數(shù)字時,可以輸入密碼,不超過 6 位,輸入完成后按下“ A”鍵開鎖,密碼正確時 LED 點亮,液晶屏顯示開鎖成功。密碼鎖具有安全性高、成本低、功耗低、易操作、記住密碼即可開鎖等優(yōu)點。若使用傳統(tǒng)的機械式鑰匙開鎖,人們常需攜帶多把鑰匙 , 使用極不方便 , 且鑰匙丟失后安全性即大打折扣。具有防盜報警等功能的電子密碼鎖代替密碼量少、安全性差的機 械式密碼鎖已是必然趨勢。 目前使用的電子密碼鎖大部分是基于單片機技術(shù),以單片機為主要器件,其編碼器與解碼器的生成為軟件方式。其它鍵功能是: B 上鎖, C 重新輸入密碼, D 保存新密碼, E 清除,重設(shè)密碼時要求先輸入正確密碼成功開鎖 ) , 除上述基本的密碼鎖功能外,依據(jù)實際的情況還可以添加遙控功能。它的種類很多,有簡易的電路產(chǎn)品,也有基于芯片的性價比較高的產(chǎn)品。隨機開鎖成功率幾乎為零。 5) 使用靈活性好,不像機械鎖必須佩帶鑰匙才能開鎖。修改密碼之 前必須再次輸入就的密碼,在輸入新密碼的時候要二次確認(rèn),以防止誤操作?;谝陨弦蛩乇驹O(shè)計選用單片機 AT89C51 作為本設(shè)計的核心元件,利用單片機靈活的編程設(shè)計和豐富的 I/O 端口,及其控制的準(zhǔn)確性,實現(xiàn)基本的密碼鎖功能。 6 新密碼輸入無誤后按確認(rèn)鍵使新密碼將得到存儲,密碼修改成功。 本系統(tǒng)共有兩部分構(gòu)成,即硬件部分與軟件部分。采用的是矩陣式按鍵鍵盤,它由行線和列線組成,也稱行列式鍵盤,按鍵位于行列的交叉點上,密碼鎖的密 碼由鍵盤輸入完成,與獨立式按鍵鍵盤相比,要節(jié)省很多 I/O 口。本設(shè)計的顯示部分由液晶顯示器 LCD1602 取代普通的數(shù)碼管來完成。當(dāng)密碼輸入完成時,按下確認(rèn)鍵,如果輸入的密碼正確的話, LCD 子顯示“ RIGHT”,單片機其中 引角會輸出低電平,使三極管 T2導(dǎo)通,電磁鐵吸合,電子密碼鎖被打開,如果密碼不正確, LCD 顯示屏?xí)@示“ ERROR”, 輸出的是高電平,電子密碼鎖不能被打開。如圖所示: L S 1S O UND E R 密碼存儲電路 24C04A 是 ATMEL 公司的 2KB 字節(jié)的電可擦除存儲芯片,采用兩線串行的總線和單片機通訊,電壓最低可以到 ,額定電流為 1mA,靜態(tài)電流 10Ua(),芯片內(nèi)的資料可以在斷電的情況下保存 40 年以上,而且采用 8 腳的 DIP 封裝,使用方便。該器件采用 ATMEL 高密度非易失存 儲器制造技術(shù)制造,與工業(yè)標(biāo)準(zhǔn)的MCS51 指令集和輸出管腳相兼容。 Keil 不僅支持 C 語言還支持匯編語言。 uchar code Title_Text[]=Your Password...。 void Display_String(uchar *str, uchar LineNo)。 uchar SendString(uchar Slave, uchar Subaddr, uchar *Buffer, uchar N)。 void delayms(uint x) { uchar i。 } } void Beep() { uchar i。BEEP=~BEEP。 DSY_BUFFER[0]=39。 uchar IS_Valid_User=0。 TL0=175。 IIC_24C04_Init()。\039。 case 4: case 5: case 6: case 7: case 8: case 9: if(i=0) Dis