74HC165按键扫描

贴上百度百科74HC165的基本信息

 

 

 我们的方案是采用两个165芯片级联,读取16个按键信息

 

 

 

 

 

 

 1 UINT8 HAL_Btn_Read74HCT165(void)
 2 {
 3     UINT8 i;
 4     UINT16 ret=0; 
 6     KEY_SE_CLR;         
 8     KEY_SE_SET;    
10     ret |= KEY_QH_READ;    
12     for(i=0; i<15; i++)  
13     {        
14         ret <<= 1;      
16         KEY_CLK_SET;   
18         CD74HC165_Delay();
20         KEY_CLK_CLR;
22         ret |= KEY_QH_READ;       
23     }         
25     return ret;         
26 }

 

 

 

 

参考:

1.http://www.elecfans.com/yuanqijian/yinjiaotu/20180202628718_2.html

2.https://blog.csdn.net/k1ang/article/details/87898554

posted @ 2021-12-23 16:37  xjxcxjx  阅读(1019)  评论(0编辑  收藏  举报