#include<reg52.h>#define uchar unsigned char#define uint unsigned int //#define GPIO_KEY P1 //
カィメ蠍タチ「ーエシ・1
カヒソレ//#define GPIO_DIG P0 //
カィメ薛ED
ハ
ツ・ワ カヒ uchar code SMG_P0[]={ 0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e,0x00}; uchar keyxianshi; void delay(uint z){ uintx,y ; for(x=z;x>0;x--) for(y=112;y>0;y--);} void KEY_Scan(){ uchar a=0 ; P1= 0x0f; if(P1!= 0x0f)//
イサオネモレ { delay(10); if(P1!=0x0f) { P1 = 0x0f; switch(P1) { case0x07: keyxianshi = 0; break; case0x0b: keyxianshi = 1; break; case0x0d: keyxianshi = 2; break; case0x0e: keyxianshi = 3; break; } P1 =0xf0; switch(P1) { case0x70: keyxianshi = keyxianshi;break; case0xb0: keyxianshi = keyxianshi+4;break; case0xd0: keyxianshi = keyxianshi+8;break; case0xe0: keyxianshi = keyxianshi+12;break; } while((a<50)&&(P1 !=0xf0)); { delay(10); a++; } } } } void main(){ while(1); { KEY_Scan(); P0 = SMG_P0[keyxianshi]; }}
此帖出自
小平头技术问答
一周热门 更多>