1 //write by:cyt
 2 //Time:2017-2-10
 3 //Porject Name:key shake_destory
 4 #include<reg51.h>
 5 #define GPIO_KEY P0///
 6 void Delay1ms(unsigned char n);
 7 unsigned char Key_Scan()   //    GPIO_KEY为全局变量,在这里作输入
 8 {
 9     unsigned char i=0,Key_Value=0;
10     if(GPIO_KEY!=0xff)
11     {
12         Delay1ms(10);
13         if(GPIO_KEY!=0xff)
14             Key_Value = GPIO_KEY;
15         while(GPIO_KEY!=0xff&&i<50)
16         {
17             Delay1ms(10);
18             i++;
19         }
20     }
21     return Key_Value;
22 }
key按键扫描

相关文章:

  • 2021-08-24
  • 2021-09-10
  • 2021-04-27
  • 2022-02-08
  • 2022-02-09
  • 2022-12-23
猜你喜欢
  • 2021-12-04
  • 2021-08-23
  • 2021-10-27
  • 2022-12-23
  • 2021-12-04
  • 2021-12-23
  • 2021-08-07
相关资源
相似解决方案