自己做的基于單片機的密碼鎖設(shè)計(c語言設(shè)計)
if(h2==0)//0鍵掃描
{
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) //#鍵掃描
{
delay(1);
if(h3==0)
{
while(!h3);
while(!flge1)
cheak_identity2();
}
}
}
}
/*---------------------------------------*/ //鍵盤掃描
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++;
}
}
/*-------------------------------*/
評論