zoukankan      html  css  js  c++  java
  • 74HC595扩展按键扫描调试笔记

    问题出现在了按键扫描过程中,使用延时,但是为什么使用延时就检测不到,还是没琢磨明白。

    #include "hc595.h"
    
    /*-------------------------- 按键扫描程序 -----------------------------*/
    
    unsigned char keyscan(void) {     unsigned char Val;  SendByte(0x1b);  LINE_SET;
    
     if((P4&0x70)!=0x70)  {
    
       Val = P4&0x70;    Val+=0x1b;    while((P4&0x70)!=0x70);    delay_10ms(1);    while((P4&0x70)!=0x70);    return Val;
    
     }  SendByte(0x17);  LINE_SET;
    
     if((P4&0x70)!=0x70)  {
    
       Val = P4&0x70;    Val+=0x17;    while((P4&0x70)!=0x70);    delay_10ms(1);    while((P4&0x70)!=0x70);    return Val;
    
     }
    
     SendByte(0x0f);  LINE_SET;
    
     if((P4&0x70)!=0x70)  {
    
       Val = P4&0x70;    Val+=0x0f;    while((P4&0x70)!=0x70);    delay_10ms(1);    while((P4&0x70)!=0x70);    return Val;
    
     }  SendByte(0x1d);  LINE_SET;
    
     if((P4&0x70)!=0x70)  {
    
       Val = P4&0x70;    Val+=0x1d;    while((P4&0x70)!=0x70);    delay_10ms(1);    while((P4&0x70)!=0x70);    return Val;
    
     }  SendByte(0x1e);  LINE_SET;
    
     if((P4&0x70)!=0x70)  {
    
       Val = P4&0x70;    Val+=0x1e;    while((P4&0x70)!=0x70);    delay_10ms(1);    while((P4&0x70)!=0x70);    return Val;
    
     }
    
       return 0xff; }
    
     

     

  • 相关阅读:
    Scala编译环境搭建(mac IDEA)
    Scala初见
    boost spirit使用
    基于OPENCV的图像融合
    C++获取hostname&IP&MAC地址
    httpd启动检查
    react eslint 代码格式补全的插件
    将html页面导出为word
    redux的笔记
    img onerror事件的使用
  • 原文地址:https://www.cnblogs.com/bytebee/p/2868286.html
Copyright © 2011-2022 走看看