微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > MCU和单片机设计讨论 > 求大神 救命的啊

求大神 救命的啊

时间:10-02 整理:3721RD 点击:
//#include<reg52.h>
//#define uint unsigned int
//#define uchar unsigned char
//uchar Key_num;
//uint a[17]={0x00,0x0f,0xf0,0xdb,0xbd,0x7f,0x3f,0x1f,0x07,0xcd,0x8d,0xd5,0x7c,0x6e,0x7e,0xbf,0xff};
//void delay(uint x)
//{
//        uint i,j;
//        for(i=x;i>0;i--)
//                for(j=110;j>0;j--);       
//}
//void display()
//{
//        P0=a[Key_num-1];
//}
//void Keyboard(void)
//{
//        uchar temp;
//        P2=0x7f;
//        temp=P2;
//        temp=temp&0xf0;
//        if(temp!=0x0f)
//        {
//                delay(10);
//                temp=P2;
//                temp=temp&0xf0;
//                while(temp!=0xf0)
//                {
//                        switch(temp)
//                        {
//                                case 0xe0:Key_num=1;break;
//                                case 0xd0:Key_num=2;break;
//                                case 0xb0:Key_num=3;break;
//                                case 0x70:Key_num=4;break;
//                        }
//                }
////                if(temp==0xf0)
////                {
////                        Key_num=17;
////                }
//       
//        }
//        P2=0xfd;
//        temp=P2;
//        temp=temp&0xf0;
//        while(temp!=0xf0)
//        {
//                delay(10);
//                temp=P2;
//                temp=temp&0xf0;
//                while(temp!=0x0f)
//                {
//                        switch(temp)
//                        {
//                                case 0xde:Key_num=5;break;
//                                case 0xdd:Key_num=6;break;
//                                case 0xdb:Key_num=7;break;
//                                case 0xd7:Key_num=8;break;
//                        }
//                }
////                if(temp==0x0f)
////                {
////                        Key_num=17;
////                }
//       
//        }
//        P2=0xfb;
//        temp=P2;
//        temp=temp&0xf0;
//        if(temp!=0xf0)
//        {
//                delay(10);
//                temp=P2;
//                temp=temp&0xf0;                 
//                while(temp!=0xf0)
//                {
//                        switch(temp)
//                        {
//                                case 0xbe:Key_num=9;break;
//                                case 0xbd:Key_num=10;break;
//                                case 0xbb:Key_num=11;break;
//                                case 0xb7:Key_num=12;break;
//                        }
//                }
////                if(temp==0x0f)
////                {
////                        Key_num=17;
////                }
//               
//        }
//        P1=0xf7;
//        temp=P2;
//        temp=temp&0xf0;
//        if(temp!=0xf0)
//        {
//                delay(10);
//                temp=P2;
//                temp=temp&0xf0;                 
//                while(temp!=0xf0)
//                {
//                        switch(temp)
//                        {
//                                case 0x7e:Key_num=12;break;
//                                case 0x7d:Key_num=14;break;
//                                case 0x7b:Key_num=15;break;
//                                case 0x77:Key_num=16;break;
//                        }
//                }
////            if(temp==0x0f)
////                {
////                        Key_num=17;
////                }       
//        }
//       
//}
//void main(void)
//{
//        while(1)
//        {
//                Keyboard();
//                display();
//        }
//}为什么没效果

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top