標(biāo)題: 矩陣式鍵盤 [打印本頁(yè)]

作者: 阿薩啊    時(shí)間: 2017-6-15 08:41
標(biāo)題: 矩陣式鍵盤
#include <at89x51.h>
char K[16]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
int d=0;
void delay(a)
{
int i,j;
for(i=0;i<a;i++)
for(j=0;j<10;j++);
}
main()
{
while(1)
{P1=0Xfe;
        delay(100);
        if(P1==0Xee)
  {d=1;}
        if(P1==0Xde)
  {d=2;}
        if(P1==0Xbe)
  {d=3;}       
  if(P1==0X7e)
  {d=4;}
        P1=0Xfd;
        delay(100);
if(P1==0Xed)
  {d=5;}       
if(P1==0Xdd)
  {d=6;}       
if(P1==0Xbd)
  {d=7;}       
if(P1==0X7d)
  {d=8;}
        P1=0Xfb;
        delay(100);
if(P1==0Xeb)
  {d=9;}
if(P1==0Xdb)
  {d=10;}       
if(P1==0Xbb)
  {d=11;}
if(P1==0X7b)
  {d=12;}
        P1=0Xf7;
        delay(100);       
if(P1==0Xe7)
{d=13;}
if(P1==0Xd7)
  {d=14;}       
if(P1==0Xb7)
  {d=15;}
if(P1==0X77)
  {d=16;}
        P3=0xFD;P2=K[d%10];
        delay(10);
        P3=0xFE;P2=K[d/10];
        delay(10);                                 

}
}

U_7[MR{74W@6@J}9P(QTB@I.png (5.39 KB, 下載次數(shù): 64)

U_7[MR{74W@6@J}9P(QTB@I.png

作者: 1525508292    時(shí)間: 2021-12-5 20:44
有三位數(shù)管,顯示平方數(shù)的嗎?





歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1