www.久久久久|狼友网站av天堂|精品国产无码a片|一级av色欲av|91在线播放视频|亚洲无码主播在线|国产精品草久在线|明星AV网站在线|污污内射久久一区|婷婷综合视频网站

當(dāng)前位置:首頁 > 單片機(jī) > 單片機(jī)
[導(dǎo)讀]基于80C51單片機(jī)的電子儲物柜系統(tǒng)

基于80C51單片機(jī)的電子儲物柜系統(tǒng)

 

電路描述:

安全是我們?nèi)粘5纳钪凶铌P(guān)心的問題。 每個人都覺得安全問題是非常至關(guān)重要的,在家里的門和安全,可以盡可能多的安全。 為了對于門訪問安全

因此,我們打算通過引進(jìn)一個電子密碼鎖系統(tǒng),該系統(tǒng)包括一個人得到一個訪問某些項目之前要輸入密碼的安全性,以及在家里,一個房間密碼鎖系統(tǒng),不只是普通的單用戶密碼鎖系統(tǒng),需要用戶插入已編程的代碼來訪問一個房間; 它是一個密碼鎖系統(tǒng),有密碼而且可以啟用多個用戶訪問。

在基于51單片機(jī)的門儲物柜,只允許授權(quán)人員進(jìn)入限制區(qū)域的門禁系統(tǒng)。 該系統(tǒng)由8位微控制器AT89C2051具有ROM的2K字節(jié)的程序存儲器完全控制。 該系統(tǒng)具有通過該密碼,可以通過它來輸入鍵盤。 當(dāng)輸入的密碼與存儲在存儲器中的口令相等則門被打開。 如果我們輸入了錯誤的密碼超過三次,然后報警接通。

LCD的數(shù)據(jù)引腳連接到P1口和RS,R / W,E引腳連接到P0.2,P0.3,P0.4。 L293D采用旋轉(zhuǎn)電機(jī)打開和關(guān)閉更衣室。 A 4 * 3鍵盤用于輸入數(shù)字0到9,“*”,“#”。 有一個系統(tǒng)菜單,包含了開放式儲物柜三個按鈕,重設(shè)密碼,并關(guān)閉了更衣室。

code:

#include< reg51.h >

#define col P2

#define row P3

sbit m1=P3^4;

sbit m2=P3^5;

sbit bu=P0^1;

sbit rs=P0^2;

sbit rw=P0^3;

sbit en=P0^4;

sbit start=P0^5;

sbit rst=P0^6;

sbit mp=P0^7;

sfr lcddata=0x90;

void delay(int a)

{

int i,j;

for(i=0;i for(j=0;j<1100;j++);

}

void command(unsigned char s) //初始化LCD的

{

lcddata=s;

rs=0;

rw=0;

en=1;

delay(5);

en=0;

}

void lcddisplaydata(unsigned char s) // LCD的數(shù)據(jù)寫入

{

lcddata=s;

rs=1;

rw=0;

en=1;

delay(8);

en=0;

}

void displaydata(unsigned char *word)

{

int x;

for(x=0;word[x]!=0;x++) //LCD的數(shù)據(jù)寫入

{

lcddisplaydata(word[x]);

}

}

unsigned char array[3][4]={‘0′,’1′,’2′,’3′,

‘4’,’5′,’6′,’7′,

‘8’,’9′,’*’,’#’};

int n=0;

int m=0;

int i,p,q,r;

void main()

{

unsigned char colloc, rowloc;

unsigned char array1[4];

unsigned char array2[4]={‘3′,’1′,’1′,’2′};

unsigned char array3[4];

LOCKER1:

col=0xFF;

row=0x00;

m1=0;

m2=0;

bu=0;

mp=1;

p=0;

q=0;

r=0;

m=0;

start=1;

rst=1;

command(0x01);

command(0x38);

command(0x0C);

command(0x84);

displaydata(“PRESS KEY”);

command(0xC0);

displaydata(“FROM SYSTEM MENU”);

while(1)

{

if(start==0)

{

p=1;

goto LOCKER2;

}

else if(rst==0)

{

q=1;

goto LOCKER3;

}

}

LOCKER2:

n=0;

command(0x01);

command(0x82);

delay(10);

displaydata(“Enter Your”);

command(0xC3);

displaydata(“Password”);

delay(80);

command(0x01);

command(0x80);

goto LOCKER5;

LOCKER3:

n=0;

command(0x01);

command(0x82);

delay(10);

displaydata(“Enter Current”);

command(0xC4);

displaydata(“Password”);

delay(80);

command(0x01);

command(0x80);

goto LOCKER5;

LOCKER4:

n=0;

m=0;

command(0x01);

command(0x83);

delay(10);

displaydata(“Enter new”);

command(0xC3);

displaydata(” Password”);

delay(80);

command(0x01);

command(0x80);

q=2;

goto LOCKER5;

LOCKER5:

col=0xFF;

while(1)

{

do

{

row=0x00;

colloc=col;

colloc &=0x0f;

}while(colloc!=0x0f);

do

{

colloc=col;

colloc &=0x0f;

}while(colloc==0x0f);

while(1)

{

row=0x0E;

colloc=col;

colloc &=0x0f;

if(colloc!=0x0f)

{

rowloc=0;

break;

}

row=0x0D;

colloc=col;

colloc &=0x0f;

if(colloc!=0x0f)

{

rowloc=1;

break;

}

row=0x0LOCKER11;

colloc=col;

colloc &=0x0f;

if(colloc!=0x0f)

{

rowloc=2;

break;

}

}

if(p==1)

{

if(colloc==0x0E)

{

array1[n]=array[rowloc][0];

n++;

goto LOCKER6;

}

else if(colloc==0x0D)

{

array1[n]=array[rowloc][1];

n++;

goto LOCKER6;

}

else if(colloc==0x0B)

{

array1[n]=array[rowloc][2];

n++;

goto LOCKER6;

}

else if(colloc==0x07)

{

array1[n]=array[rowloc][3];

n++;

goto LOCKER6;

}

}

else if(q==1)

{

if(colloc==0x0E)

{

array1[n]=array[rowloc][0];

n++;

goto LOCKER7;

}

else if(colloc==0x0D)

{

array1[n]=array[rowloc][1];

n++;

goto LOCKER7;

}

else if(colloc==0x0B)

{

array1[n]=array[rowloc][2];

n++;

goto LOCKER7;

}

else if(colloc==0x07)

{

array1[n]=array[rowloc][3];

n++;

goto LOCKER7;

}

}

else if(r==2)

{

if(colloc==0x0E)

{

array1[n]=array[rowloc][0];

n++;

goto LOCKER11;

}

else if(colloc==0x0D)

{

array1[n]=array[rowloc][1];

n++;

goto LOCKER11;

}

else if(colloc==0x0B)

{

array1[n]=array[rowloc][2];

n++;

goto LOCKER11;

}

else if(colloc==0x07)

{

array1[n]=array[rowloc][3];

n++;

goto LOCKER11;

}

}

else if(q==2)

{

if(colloc==0x0E)

{

array2[n]=array[rowloc][0];

n++;

goto LOCKER9;

}

else if(colloc==0x0D)

{

array2[n]=array[rowloc][1];

n++;

goto LOCKER9;

}

else if(colloc==0x0B)

{

array2[n]=array[rowloc][2];

n++;

goto LOCKER9;

}

else if(colloc==0x07)

{

array2[n]=array[rowloc][3];

n++;

goto LOCKER9;

}

}

else if(q==3)

{

if(colloc==0x0E)

{

array3[n]=array[rowloc][0];

n++;

goto LOCKER8;

}

else if(colloc==0x0D)

{

array3[n]=array[rowloc][1];

n++;

goto LOCKER8;

}

else if(colloc==0x0B)

{

array3[n]=array[rowloc][2];

n++;

goto LOCKER8;

}

else if(colloc==0x07)

{

array3[n]=array[rowloc][3];

n++;

goto LOCKER8;

}

}

}

LOCKER6:

if(n<4)

{

lcddisplaydata(‘*’);

goto LOCKER5;

}

else if(n==4)

{

lcddisplaydata(‘*’);

delay(50);

if(array1[1]==array2[1]&&array1[2]==array2[2]&&array1[3]==array2[3]&&array1[0]==array2[0])

{

command(0x01);

command(0x80);

displaydata(“RIGHT PASSWORD”);

delay(50);

m=0;

n=0;

goto LOCKER14;

}

else

{

command(0x01);

command(0x80);

displaydata(“WRONG PASSWORD”);

delay(50);

goto LOCKER15;

}

}

LOCKER7:

if(n<4)

{

lcddisplaydata(‘*’);

goto LOCKER5;

}

else if(n==4)

{

lcddisplaydata(‘*’);

delay(50);

if(array1[1]==array2[1]&&array1[2]==array2[2]&&array1[3]==array2[3]&&array1[0]==array2[0])

{

goto LOCKER4;

}

else

{

goto LOCKER12;

}

}

LOCKER8:

if(n<4)

{

lcddisplaydata(‘*’);

goto LOCKER5;

}

else if(n==4)

{

lcddisplaydata(‘*’);

delay(50);

if(array3[1]==array2[1]&&array3[2]==array2[2]&&array3[3]==array2[3]&&array3[0]==array2[0])

{

command(0x01);

command(0x80);

delay(10);

displaydata(“New Password has”);

command(0xC3);

displaydata(“been set”);

delay(100);

command(0x01);

m=0;

goto LOCKER1;

}

else

{

goto LOCKER13;

}

}

LOCKER9:

if(n<4)

{

lcddisplaydata(‘*’);

goto LOCKER5;

}

else if(n==4)

{

lcddisplaydata(‘*’);

delay(50);

m=0;

goto LOCKER10;

}

LOCKER10:

{

command(0x01);

command(0x80);

delay(10);

displaydata(“Conform Password”);

delay(50);

command(0x01);

q=3;

n=0;

goto LOCKER5;

}

LOCKER11:

if(n<4)

{

lcddisplaydata(‘*’);

goto LOCKER5;

}

else if(n==4)

{

lcddisplaydata(‘*’);

delay(50);

if(array1[1]==array2[1]&&array1[2]==array2[2]&&array1[3]==array2[3]&&array1[0]==array2[0])

{

bu=0;

goto LOCKER1;

}

else

{

goto LOCKER16;

}

}

LOCKER12:

{

command(0x01);

command(0x80);

m++;

if(m<3)

goto LOCKER3;

else

bu=1;

delay(500);

bu=0;

goto LOCKER1;

}

LOCKER13:

{

command(0x01);

command(0x80);

m++;

if(m<3)

goto LOCKER10;

else

goto LOCKER1;

}

LOCKER14:

{

m1=1;

m2=0;

delay(125);

m1=0;

m2=0;

while(mp!=0);

m1=0;

m2=1;

delay(125);

m1=0;

m2=0;

delay(100);

command(0x01);

command(0x80);

goto LOCKER1;

}

LOCKER15:

{

command(0x01);

command(0x80);

m++;

if(m<3)

goto LOCKER2;

else

bu=1;

r=2;

p=0;

q=0;

n=0;

goto LOCKER5;

}

LOCKER16:

{

command(0x01);

command(0x80);

n=0;

goto LOCKER5;

}

}

本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實性等。需要轉(zhuǎn)載請聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請及時聯(lián)系本站刪除。
換一批
延伸閱讀

8位單片機(jī)在嵌入式設(shè)計領(lǐng)域已經(jīng)成為半個多世紀(jì)以來的主流選擇。盡管嵌入式系統(tǒng)市場日益復(fù)雜,8位單片機(jī)依然不斷發(fā)展,積極應(yīng)對新的挑戰(zhàn)和系統(tǒng)需求。如今,Microchip推出的8位PIC?和AVR?單片機(jī)系列,配備了先進(jìn)的獨(dú)立...

關(guān)鍵字: 單片機(jī) 嵌入式 CPU

在嵌入式系統(tǒng)開發(fā)中,程序燒錄是連接軟件設(shè)計與硬件實現(xiàn)的關(guān)鍵環(huán)節(jié)。當(dāng)前主流的單片機(jī)燒錄技術(shù)已形成ICP(在電路編程)、ISP(在系統(tǒng)編程)、IAP(在應(yīng)用編程)三大技術(shù)體系,分別對應(yīng)開發(fā)調(diào)試、量產(chǎn)燒錄、遠(yuǎn)程升級等不同場景。...

關(guān)鍵字: 單片機(jī) ISP ICP IAP 嵌入式系統(tǒng)開發(fā)

在嵌入式系統(tǒng)開發(fā)中,看門狗(Watchdog Timer, WDT)是保障系統(tǒng)可靠性的核心組件,其初始化時機(jī)的選擇直接影響系統(tǒng)抗干擾能力和穩(wěn)定性。本文從硬件架構(gòu)、軟件流程、安全規(guī)范三個維度,系統(tǒng)分析看門狗初始化的最佳實踐...

關(guān)鍵字: 單片機(jī) 看門狗 嵌入式系統(tǒng)

本文中,小編將對單片機(jī)予以介紹,如果你想對它的詳細(xì)情況有所認(rèn)識,或者想要增進(jìn)對它的了解程度,不妨請看以下內(nèi)容哦。

關(guān)鍵字: 單片機(jī) 開發(fā)板 Keil

隨著單片機(jī)系統(tǒng)越來越廣泛地應(yīng)用于消費(fèi)類電子、醫(yī)療、工業(yè)自動化、智能化儀器儀表、航空航天等各領(lǐng)域,單片機(jī)系統(tǒng)面臨著電磁干擾(EMI)日益嚴(yán)重的威脅。電磁兼容性(EMC)包含系統(tǒng)的發(fā)射和敏感度兩方面的問題。

關(guān)鍵字: 單片機(jī) 電磁兼容

以下內(nèi)容中,小編將對單片機(jī)的相關(guān)內(nèi)容進(jìn)行著重介紹和闡述,希望本文能幫您增進(jìn)對單片機(jī)的了解,和小編一起來看看吧。

關(guān)鍵字: 單片機(jī) 復(fù)位電路

在這篇文章中,小編將為大家?guī)韱纹瑱C(jī)的相關(guān)報道。如果你對本文即將要講解的內(nèi)容存在一定興趣,不妨繼續(xù)往下閱讀哦。

關(guān)鍵字: 單片機(jī) 異常復(fù)位

今天,小編將在這篇文章中為大家?guī)韱纹瑱C(jī)的有關(guān)報道,通過閱讀這篇文章,大家可以對它具備清晰的認(rèn)識,主要內(nèi)容如下。

關(guān)鍵字: 單片機(jī) 仿真器

單片機(jī)將是下述內(nèi)容的主要介紹對象,通過這篇文章,小編希望大家可以對它的相關(guān)情況以及信息有所認(rèn)識和了解,詳細(xì)內(nèi)容如下。

關(guān)鍵字: 單片機(jī) 中斷 boot

一直以來,單片機(jī)都是大家的關(guān)注焦點(diǎn)之一。因此針對大家的興趣點(diǎn)所在,小編將為大家?guī)韱纹瑱C(jī)的相關(guān)介紹,詳細(xì)內(nèi)容請看下文。

關(guān)鍵字: 單片機(jī) 數(shù)字信號 模擬信號
關(guān)閉