#include<reg51.h>
char password=000000;
char led_mod[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
char key_buf[]={0xd7,0xee,0xde,0xbe,0xed,0xdd,0xbd,0xeb,0xdb,0xbb,0xe7,0xb7,0x7e,0x7d};
char mm[];
char input()
{
char key_scan[]={0xef,0xdf,0xbf};
char i=0,j=0;
for(i;i<4;i++){
P3=key_scan[i];
if((P3&0x0f)!=0x0f){
for(j=0;j<=9;j++){
if(key_buf[j]==P3)
return j;}}}return -1;}
void main()
{
char k=0,n=0;
for(n;n<6;n++){
k= input();while((P3&0x0f)!=0x0f){
if(k<=9&&n==0&&k!=-1)
{P2=0x01;P0=led_mod[k];}
if(k<=9&&n==1&&k!=-1)
{P2=0x02;P0=led_mod[k];}}
}}
-
电路图
一周热门 更多>