51单片机43矩阵键盘6位密码锁语言程序c

展开全部
#includestdio
h #includereg 51
h#defineucharunsignedcharucharkey; inti = 0。斯德凡·夏邦尼耶是[4]={0,0,0,0 //输入密码是在这里,密码是否是正确的与所述第一密码被确定进行比较。voidkeyscan()//扫描按钮被按下{uchartemp; P3 = 0xFE的;}//扫描第一线温度= P3;温度= tempif(一点!
= 0XF0)/ /{delayms(10)按钮确定是否没有被按下; //防抖动温度= P3。temp = tempif(临时!
= 0XF0)该//按钮被按下{临时= P3确保;开关(暂时){case0xee:键= 0break; case0xde:键= 1 case0xbe:键= 2断裂; case0x7e:键= 3break;虽然(临时!
= 0XF0)//按钮,以确定是否被释放{临时= P3;温度=温度}B[I]=键;我++;如果(I == 3)I = 0;}}P3 =0xfd; //第二行扫描温度线= P3。temp = tempif(临时!
= 0×f 0){延迟ms(10);温度= P 3。temp = tempif(临时!
= 0XF0){温度= P3 ;:开关(一点){case0xed:密钥= 4歇; case0xdd:密钥= 5Case0xbd:密钥= 6断裂; case0x7d:键= 7break;}而(温度!
= 0XF0){温度= P3;温度=温度}B[I]=键;我++;如果(I == 3)I = 0;}}P3 = 0xFB的才能; //扫描第三行温度=P3; temp = Tempif(临时!
= 0×f 0){延迟ms(10);温度= P 3。temp = tempif(临时!
= 0XF0){温度= P3;开关(暂时){case0xeb:键= 8break; case0xdb:键= 9break; case0xbb:键= Abreak; case0x7b:键= Bbreak;}而(一点!
= 0XF0){温度= P3;温度=温度}B[I]=键;我++;如果(I == 3)I = 0;}}P3 = 0xf7; //扫描第四行温度=P3; temp = Tempif(临时!
= 0×f 0){延迟ms(10);温度= P 3。temp = tempif(临时!
= 0XF0){温度= P3;开关(暂时){case0xe7:键= CBREAK; case0xd7:键= Dbreak; case0xb7:键= Ebreak; case0x77:键= F破裂;}而同时(暂时!
= 0XF0){温度= P3;温度=温度}B[I]=键;我++;如果(I == 3)I = 0;}}}主(){甜心[4]={3,5中,a,C / /这是初始密码,(1)/ /无限循环,的b0-3四个数字的值{键扫描();}和拥有。如果(A[0]== B[0]&&一个[1]== B[1]&&一个[2]== B[2]&&[3]== B[3]){//?我如何在这里写出正确的密码?}}