Design of password lock based on single chip microcomputer (designed in C language)

Publisher:平和的心情Latest update time:2011-08-23 Source: EEWORLD Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Design of password lock based on single chip microcomputer (designed in C language)

System Description

As shown in the figure, the system uses 80C51 single-chip microcomputer, ordinary keyboard, resistor array, and 1602 LCD.

The system features:

①When the correct password is entered into the system, the LED light will light up (in fact, many operations can be performed, and the LED is used only to represent the function. The main purpose is simple operation and obvious effect.)

② The system can modify the password; (After the system is powered off and restarted, the initial password (initial password is: 000000) must be used to change the password again. Of course, the modified password can be the same as before the power failure.)

Specific operations:

①When the system is turned on, a prompt will appear asking you to enter your password. Enter the password directly and press # to confirm.

②The system will automatically remind you that the password is incorrect, and after a few seconds the system will remind you to re-enter the password.

③In the interface where the system prompts you to enter your password, you can press the * key to modify your password. The system will prompt you to enter your password twice and check whether the two passwords are the same. If they are the same, the modification is successful. Otherwise, you can press the * key again to modify it after a few seconds.

④ Before changing the password (that is, after pressing the * key), the system will remind you to identify yourself. Please enter the old password. The system can only change the password after it determines that the old password is correct.

Source Program

#include
#define uchar unsigned char
#define uint unsigned int
sbit lcdrs=P3^0;
sbit lcdrw=P3^1;
sbit lcden=P3^2;
sbit h1=P1^0;
sbit h2=P1^ 1;
sbit h3=P1^2;
sbit sa=P1^3;
sbit sb=P1^4;
sbit sc=P1^5;
sbit sd=P1^6;
sbit kd=P3^7;
uchar code table[]= " PLEASE INPUT ";
uchar code table1[]="CODE: ";
uchar code table2[]=" *****WIN*****";
uchar code table3[]=" PLEASE AFFIRM";
uchar code table4 []=" *****FAIL*****";
uchar code table5[]=" MODIFICATION";
uchar code table6[]=" IDENTITY LIMITS ";
uchar unm,M1,M2,M3,M4,M5,M6,sex,k1,k2,k3,k4,k5,k6,flge,flge1;
uchar q1, q2,q3,q4,q5,q6,w1,w2,w3,w4,w5,w6,g;

void delay(int z)
{
int x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}

void delay1(int z)
{
int x,y;
for(x=z;x>0;x--)
for(y=20000;y>0;y--);
}

void writen_com(uchar com) //1602 write command
{
lcdrs=0;
P0=com;
delay(1);
lcden=1;
delay(1);
lcden=0;
}

void writen_dat(uchar dat) //1602 write data
{
lcdrs=1;
P0=dat;
delay(1);
lcden=1;
delay(1);
lcden=0;
}

void main();

void cheak_mima() //Check if the second confirmation password is the same as the first
{
if(q1==w1)
{
if(q2==w2)
{
if(q3==w3)
{
if(q4==w4)
{
if(q5==w5)
{
if(q6==w6)
{
writen_com(0x01);
writen_com(0x0f);
writen_com(0x06);
writen_com(0x80);
for(unm=0;unm<14;unm++)
{
writen_dat(table5[unm]);
delay(5);
}
writen_com(0x80+0x40+1);
for(unm=0;unm<14;unm++)
{
writen_dat(table2[unm]);
delay(5);
}

M1=w1;
M2=w2;
M3=w3;
M4=w4;
M5=w5;
M6=w6;

delay1(6);
main();
}
/*-----------------------------------*/ / /Password confirmation error returns
writen_com(0x01);
writen_com(0x80);
for(unm=0;unm<14;unm++)
{
writen_dat(table4[unm]);
delay(5);
}
delay1(6);
main() ;
}
writen_com(0x01);
writen_com(0x80);
for(unm=0;unm<14;unm++)
{
writen_dat(table4[unm]);
delay(5);
}
delay1(6);
main();
}
writen_com (0x01);
writen_com(0x80);
for(unm=0;unm<14;unm++)
{
writen_dat(table4[unm]);
delay(5);
}
delay1(6);
main();
}
writen_com(0x01) ;
writen_com(0x80);
for(unm=0;unm<14;unm++)
{
writen_dat(table4[unm]);
delay(5);
}
delay1(6);
main();
}
writen_com(0x01);
writen_com(0x80);
for(unm =0;unm<14;unm++)
{
writen_dat(table4[unm]);
delay(5);
}
delay1(6);
main();
}
writen_com(0x01);
writen_com(0x80);
for(unm=0; unm<14;unm++)
{
writen_dat(table4[unm]);
delay(5);
}
delay1(6);
main();
}

/*------------------------------------*/ //Second confirmation of password

void affirm_code()
{
P1=0x07;
if(P1!=0x07)
delay(1);
if(P1!=0x07)
{
P1=0x77;
if(h1==0)
{
delay(1);
if(h1= =0)
{
while(!h1);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:w1=1;break;
case 1:w2=1;break;
case 2:w3=1;break;
case 3:w4=1;break;
case 4:w5=1;break;
case 5:w6=1;break;
}
sex++;
}
}
if(h2==0)
{
delay( 1);
if(h2==0)
{
while(!h2);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:w1=2;break;
case 1:w2=2;break;
case 2:w3=2;break;
case 3:w4=2;break;
case 4:w5=2;break;
case 5:w6=2;break;
}
sex++;
}
}
if(h3==0)
{
delay(1);
if(h3==0)
{
while(!h3);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:w1=3;break;
case 1:w2=3;break;
case 2:w3=3;break;
case 3:w4=3;break;
case 4 :w5=3;break;
case 5:w6=3;break;
}
sex++;
}
}
/*--------------------------- ----*/
P1=0x6f;
if(h1==0)
{
delay(1);
if(h1==0)
{
while(!h1);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:w1=4;break;
case 1:w2=4;break;
case 2:w3=4;break;
case 3:w4=4;break;
case 4:w5=4;break;
case 5:w6=4;break;
}
sex++;
}
}
if (h2==0)
{
delay(1);
if(h2==0)
{
while(!h2);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0: w1=5;break;
case 1:w2=5;break;
case 2:w3=5;break;
case 3:w4=5;break;
case 4:w5=5;break;
case 5:w6=5;break;
}
sex++;
}
}
if(h3==0)
{
delay(1);
if(h3==0)
{
while(!h3);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex )
{
case 0:w1=6;break;
case 1:w2=6;break;
case 2:w3=6;break;
case 3:w4=6;break;
case 4:w5=6;break;
case 5: w6=6;break;
}
sex++;
}
}
/*--------------------------------*/
P1=0x5f ;
if(h1==0)
{
delay(1);
if(h1==0)
{
while(!h1);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:w1=7;break;
case 1:w2=7;break;
case 2:w3=7;break;
case 3:w4=7;break;
case 4:w5=7;break;
case 5:w6=7;break;
}
sex++;
}
}
if(h2==0)
{
delay( 1);
if(h2==0)
{
while(!h2);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:w1=8;break;
case 1: w2=8;break;
case 2:w3=8;break;
case 3:w4=8;break;
case 4:w5=8;break;
case 5:w6=8;break;
}
sex++;
}
}
if(h3 ==0)
{
delay(1);
if(h3==0)
{
while(!h3);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:w1=9;break;
case 1:w2=9;break;
case 2:w3=9;break;
case 3:w4=9;break;
case 4:w5=9;break;
case 5:w6=9;break;
}
sex++;
}
}
/*---------------------------------- -*/
P1=0x3f;
if(h2==0) //0 key scan
{
delay(1);
if(h2==0)
{
while(!h2);
writen_com(0x80+0x45+sex);
writen_dat( '*');
switch(sex)
{
case 0:w1=0;break;
case 1:w2=0;break;
case 2:w3=0;break;
case 3:w4=0;break;
case 4:w5 =0;break;
case 5:w6=0;break;
}
sex++;
}
}
if(h3==0) //#Key scan
{
delay(1);
if(h3==0)
{
while(!h3);
while(!flge1)
cheak_mima();
}
}
}
}

/*--------------------------------------*/ //Change password

void set_mima()
{
P1=0x07;
if(P1!=0x07)
delay(1);
if(P1!=0x07)
{
P1=0x77;
if(h1==0)
{
delay(1);
if(h1= =0)
{
while(!h1);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:q1=1;break;
case 1:q2=1;break;
case 2:q3=1;break;
case 3:q4=1;break;
case 4:q5=1;break;
case 5:q6=1;break;
}
sex++;
}
}
if(h2==0)
{
delay( 1);
if(h2==0)
{
while(!h2);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:q1=2;break;
case 1:q2=2;break;
case 2:q3=2;break;
case 3:q4=2;break;
case 4:q5=2;break;
case 5:q6=2;break;
}
sex++;
}
}
if(h3==0)
{
delay(1);
if(h3==0)
{
while(!h3);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:q1=3;break;
case 1:q2=3;break;
case 2:q3=3;break;
case 3:q4=3;break;
case 4 :q5=3;break;
case 5:q6=3;break;
}
sex++;
}
}
P1=0x6f;
if(h1==0)
{
delay(1);
if(h1==0)
{
while(!h1);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:q1=4;break;
case 1:q2=4 ;break;
case 2:q3=4;break;
case 3:q4=4;break;
case 4:q5=4;break;
case 5:q6=4;break;
}
sex++;
}
}
if(h2==0 )
{
delay(1);
if(h2==0)
{
while(!h2);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:q1=5;break ;
case 1:q2=5;break;
case 2:q3=5;break;
case 3:q4=5;break;
case 4:q5=5;break;
case 5:q6=5;break;
}
sex++;
}
}
if(h3==0)
{
delay(1);
if(h3==0)
{
while(!h3);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0 :q1=6;break;
case 1:q2=6;break;
case 2:q3=6;break;
case 3:q4=6;break;
case 4:q5=6;break;
case 5:q6=6; break;
}
sex++;
}
}
P1=0x5f;
if(h1==0)
{
delay(1);
if(h1==0)
{
while(!h1);
writen_com(0x80+0x45+sex);
writen_dat(' *');
switch(sex)
{
case 0:q1=7;break;
case 1:q2=7;break;
case 2:q3=7;break;
case 3:q4=7;break;
case 4:q5=7;break;
case 5:q6=7;break;
}
sex++;
}
}
if(h2==0)
{
delay(1);
if(h2==0 )
{
while(!h2);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:q1=8;break;
case 1:q2=8;break;
case 2: q3=8;break;
case 3:q4=8;break;
case 4:q5=8;break;
case 5:q6=8;break;
}
sex++;
}
}
if(h3==0)
{
delay(1) ;
if(h3==0)
{
while(!h3);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:q1=9;break;
case 1:q2=9;break;
case 2:q3=9;break;
case 3:q4=9;break;
case 4:q5=9;break;
case 5:q6=9 ;break;
}
sex++;
}
}
P1=0x3f;
if(h2==0) //0 key scan
{
delay(1);
if(h2==0)
{
while(!h2);
writen_com(0x80+0x45+ sex);
writen_dat('*');
switch(sex)
{
case 0:q1=0;break;
case 1:q2=0;break;
case 2:q3=0;break;
case 3:q4=0;break ;
case 4:q5=0;break;
case 5:q6=0;break;
}
sex++;
}
}
if(h3==0) //#key scan
{
delay(1);
if(h3==0)
{
while(!h3);
writen_com(0x01);
writen_com(0x0f);
writen_com(0x06);
writen_com(0x80);
for(unm=0;unm<14;unm++)
{
writen_dat(table3[unm]);
delay(5);
}
writen_com(0x80+0x40);

for(unm=0;unm<5;unm++)
{
writen_dat(table1[unm]);
delay(5);
}
sex=0;
while(!flge1)
affirm_code();
}
}
}
}

void init();
void cheak_identity2()
{
if(k1==M1)
{
if(k2==M2)
{
if(k3==M3)
{
if(k4==M4)
{
if(k5==M5)
{
if(k6==M6)
{
sex=0;
init();
while(!flge1)
set_mima();
}
writen_com(0x01);
writen_com(0x0c);
writen_com(0x06);
writen_com(0x80);
for(unm= 0;unm<14;unm++)
{
writen_dat(table4[unm]);
delay(5);
}
delay1(6);
main();
}
writen_com(0x01);
writen_com(0x0c);
writen_com(0x06);
writen_com( 0x80);
for(unm=0;unm<14;unm++)
{
writen_dat(table4[unm]);
delay(5);
}
delay1(6);
main();
}
writen_com(0x01);
writen_com(0x0c);
writen_com(0x06);
writen_com(0x80);
for(unm=0; unm<14;unm++)
{
writen_dat(table4[unm]);
delay(5);
}
delay1(6);
main();
}
writen_com(0x01);
writen_com(0x0c);
writen_com(0x06);
writen_com(0x80) ;
for(unm=0;unm<14;unm++)
{
writen_dat(table4[unm]);
delay(5);
}
delay1(6);
main();
}

}
writen_com(0x01);
writen_com(0x0c);
writen_com (0x06);
writen_com(0x80);
for(unm=0;unm<14;unm++)
{
writen_dat(table4[unm]);
delay(5);
}
delay1(6);
main();
}

void cheak_identity()
{
P1=0x07;
if(P1!=0x07)
delay(1);
if(P1!=0x07)
{
P1=0x77;
if(h1==0)
{
delay(1);
if(h1= =0)
{
while(!h1);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:k1=1;break;
case 1:k2=1;break;
case 2:k3=1;break;
case 3:k4=1;break;
case 4:k5=1;break;
case 5:k6=1;break;
}
sex++;
}
}
if(h2==0)
{
delay( 1);
if(h2==0)
{
while(!h2);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:k1=2;break;
case 1:k2=2;break;
case 2:k3=2;break;
case 3:k4=2;break;
case 4:k5=2;break;
case 5:k6=2;break;
}
sex++;
}
}
if(h3==0)
{
delay(1);
if(h3==0)
{
while(!h3);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:k1=3;break;
case 1:k2=3;break;
case 2:k3=3;break;
case 3:k4=3;break;
case 4 :k5=3;break;
case 5:k6=3;break;
}
sex++;
}
}
/*--------------------------- ----*/

P1=0x6f;
if(h1==0)
{
delay(1);
if(h1==0)
{
while(!h1);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex )
{
case 0:k1=4;break;
case 1:k2=4;break;
case 2:k3=4;break;
case 3:k4=4;break;
case 4:k5=4;break;
case 5: k6=4;break;
}
sex++;
}
}
if(h2==0)
{
delay(1);
if(h2==0)
{
while(!h2);
writen_com(0x80+0x45+sex);
writen_dat(' *');
switch(sex)
{
case 0:k1=5;break;
case 1:k2=5;break;
case 2:k3=5;break;
case 3:k4=5;break;
case 4:k5=5;break;
case 5:k6=5;break;
}
sex++;
}
}
if(h3==0)
{
delay(1);
if(h3==0 )
{
while(!h3);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:k1=6;break;
case 1:k2=6;break;
case 2: k3=6;break;
case 3:k4=6;break;
case 4:k5=6;break;
case 5:k6=6;break;
}
sex++;
}
}
/*---------- -----------------------*/
P1=0x5f;
if(h1==0)
{
delay(1);
if(h1==0)
{
while (!h1);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:k1=7;break;
case 1:k2=7;break;
case 2:k3=7;break;
case 3:k4=7;break;
case 4 :k5=7;break;
case 5:k6=7;break;
}
sex++;
}
}
if(h2==0)
{
delay(1);
if(h2==0)
{
while(!h2);
writen_com( 0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:k1=8;break;
case 1:k2=8;break;
case 2:k3=8;break;
case 3:k4 =8;break;
case 4:k5=8;break;
case 5:k6=8;break;
}
sex++;
}
}
if(h3==0)
{
delay(1);
if(h3==0)
{
while(!h3);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:k1=9;break;
case 1:k2=9;break;
case 2:k3=9;break;
case 3 :k4=9;break;
case 4:k5=9;break;
case 5:k6=9;break;
}
sex++;
}
}
/*------------------ ------------------*/

P1=0x3f;
if(h2==0) //0 key scan
{
delay(1);
if(h2==0)
{
while(!h2);
writen_com(0x80+0x45+sex);
writen_dat('*' );
switch(sex)
{
case 0:k1=0;break;
case 1:k2=0;break;
case 2:k3=0;break;
case 3:k4=0;break;
case 4:k5=0; break;
case 5:k6=0;break;
}
sex++;
}
}
if(h3==0) //#key scan
{
delay(1);
if(h3==0)
{
while(!h3);
while( !flge1)
cheap_identity2();
} }
}
}
/
*---------------------------------------- --*/ //Keyboard scan
void keyscan()
{
P1=0x07;
if(P1!=0x07)
delay(1);
if(P1!=0x07)
{
P1=0x77;
if(h1==0)
{
delay(1);
if(h1==0)
{
while(!h1);
writen_com(0x80+0x45+ sex);
writen_dat('*');
switch(sex)
{
case 0:k1=1;break;
case 1:k2=1;break;
case 2:k3=1;break;
case 3:k4=1;break ;
case 4:k5=1;break;
case 5:k6=1;break;
}
sex++;
}
}
if(h2==0)
{
delay(1);
if(h2==0)
{
while(!h2) ;
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:k1=2;break;
case 1:k2=2;break;
case 2:k3=2;break;
case 3:k4=2;break;
case 4:k5=2;break;
case 5:k6=2;break;
}
sex++;
}
}
if(h3==0)
{
delay( 1);
if(h3==0)
{
while(!h3);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:k1=3;break;
case 1: k2=3;break;
case 2:k3=3;break;
case 3:k4=3;break;
case 4:k5=3;break;
case 5:k6=3;break;
}
sex++;
}
}
/*- ----------------------------------*/

P1=0x6f;
if(h1==0)
{
delay(1);
if(h1==0)
{
while(!h1);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex )
{
case 0:k1=4;break;
case 1:k2=4;break;
case 2:k3=4;break;
case 3:k4=4;break;
case 4:k5=4;break;
case 5: k6=4;break;
}
sex++;
}
}
if(h2==0)
{
delay(1);
if(h2==0)
{
while(!h2);
writen_com(0x80+0x45+sex);
writen_dat(' *');
switch(sex)
{
case 0:k1=5;break;
case 1:k2=5;break;
case 2:k3=5;break;
case 3:k4=5;break;
case 4:k5=5;break;
case 5:k6=5;break;
}
sex++;
}
}
if(h3==0)
{
delay(1);
if(h3==0 )
{
while(!h3);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:k1=6;break;
case 1:k2=6;break;
case 2: k3=6;break;
case 3:k4=6;break;
case 4:k5=6;break;
case 5:k6=6;break;
}
sex++;
}
}
/*---------- -----------------------*/
P1=0x5f;
if(h1==0)
{
delay(1);
if(h1==0)
{
while (!h1);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:k1=7;break;
case 1:k2=7;break;
case 2:k3=7;break;
case 3:k4=7;break;
case 4 :k5=7;break;
case 5:k6=7;break;
}
sex++;
}
}
if(h2==0)
{
delay(1);
if(h2==0)
{
while(!h2);
writen_com( 0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:k1=8;break;
case 1:k2=8;break;
case 2:k3=8;break;
case 3:k4 =8;break;
case 4:k5=8;break;
case 5:k6=8;break;
}
sex++;
}
}
if(h3==0)
{
delay(1);
if(h3==0)
{
while(!h3);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch(sex)
{
case 0:k1=9;break;
case 1:k2=9;break;
case 2:k3=9;break;
case 3 :k4=9;break;
case 4:k5=9;break;
case 5:k6=9;break;
}
sex++;
}
}
/*------------------ ------------------*/
P1=0x3f;
if(h1==0) //*Key scan
{
delay(1);
if(h1==0)
{
while (!h1);
writen_com(0x0f);
writen_com(0x06);
writen_com(0x80);
for(unm=0;unm<16;unm++)
{
writen_dat(table6[unm]);
delay(5);
}
while(! flge1)
cheap_identity();
}
}
if(h2==0) //0 key scan
{
delay(1);
if(h2==0)
{
while(!h2);
writen_com(0x80+0x45+sex);
writen_dat('*');
switch( sex)
{
case 0:k1=0;break;
case 1:k2=0
;break; case 2:k3=0;break;
case 3:k4=0;break;
case 4:k5=0;break;
case 5 :k6=0;break;
}
sex++;
}
}
if(h3==0) //#key scan
{
delay(1);
if(h3==0)
{
while(!h3);
flge=1;
}
}
}
}

/*----------------------------------------*/ //Password check
void init();
void check_code()
{
if(k1==M1)
{
if(k2==M2)
{
if(k3==M3)
{
if(k4==M4)
{
if(k5==M5)
{
if(k6== M6)
{
writen_com(0x01);
kd=0;
writen_com(0x0c)
; writen_com(0x06);
writen_com(0x80);
for(unm=0;unm<14;unm++)
{
writen_dat(table2[unm]);
delay( 5);
}
delay1(6);
kd=1;
main();
writen_com(0x0c);
writen_com(0x06);
writen_com(0x80);
for(unm=0;unm<14;unm++)
{
writen_dat(table4[unm ]);
delay(5);
}
delay1(6);
main();
}
writen_com(0x0c);
writen_com(0x06);
writen_com(0x80);
for(unm=0;unm<14;unm++)
{
writen_dat(table4[unm]);
delay(5) ;
}
delay1(6);
main();
}
writen_com(0x0c);
writen_com(0x06);
writen_com(0x80);
for(unm=0;unm<14;unm++)
{
writen_dat(table4[unm]);
delay( 5);
}
delay1(6);
main();
}
writen_com(0x0c);
writen_com(0x06);
writen_com(0x80);
for(unm=0;unm<14;unm++)
{
writen_dat(table4[unm]);
delay(5);
}
delay1(6);
main();
}
writen_com(0x0c);
writen_com(0x06);
writen_com(0x80);
for(unm=0;unm<14;unm++)
{
writen_dat(table4[unm]);
delay(5);
}
delay1(6);
main() ;
}

}
writen_com(0x0c);
writen_com(0x06);
writen_com(0x80);
for(unm=0;unm<14;unm++)
{
writen_dat(table4[unm]);
delay(5);
}
delay1(6);
main();
}

void now_mima()
{
M1=0;
M2=0;
M3=0;
M4=0;
M5=0;
M6=0;
g=0;
}
void init()
{
if(g==0)
now_mima();
g=1;
flge1=0;
flge=0;
sex=0;
lcdrw=0;
lcden=0;
writen_com(0x01);
writen_com(0x38);
writen_com(0x0f);
writen_com(0x06);
writen_com(0x80);
for (unm=0;unm<14;unm++)
{
writen_dat(table[unm]);
delay(5);
}
writen_com(0x80+0x40);

for(unm=0;unm<5;unm++)
{
writen_dat(table1[unm]);
delay(5);
}
}

void main()
{
while(1)
{
init();
set_mima();
while(!flge)
keyscan();
check_code();
}
}

Reference address:Design of password lock based on single chip microcomputer (designed in C language)

Previous article:Design of a Simple Digital Oscilloscope Based on AT89S52 Single Chip Microcomputer
Next article:Design of single chip microcomputer development board based on MC9S12XS128

Latest Industrial Control Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号