標(biāo)題: 這是我親手寫的STM32F103寄存器版電容觸摸按鍵實(shí)驗(yàn),程序已經(jīng)最精簡(jiǎn)了。 [打印本頁(yè)]

作者: 書(shū)眉間清風(fēng)    時(shí)間: 2020-3-30 01:10
標(biāo)題: 這是我親手寫的STM32F103寄存器版電容觸摸按鍵實(shí)驗(yàn),程序已經(jīng)最精簡(jiǎn)了。
這是我親手寫的STM32F103寄存器版電容觸摸按鍵實(shí)驗(yàn)。

單片機(jī)源程序如下:
  1. #include "tpad.h"
  2. #include "sys.h"
  3. #include "usart.h"
  4. #include "delay.h"




  5. int main()
  6. {
  7.         int i=0;
  8.                
  9.         Stm32_Clock_Init(9);
  10.         LED_init();
  11.         uart_init(72,115200);
  12.         delay_init(72);
  13.         TPAD_Init(6);
  14.        
  15.        
  16.         while(1)
  17.         {
  18.                         if(TPAD_Scan(0))
  19.                         {
  20.                                        
  21.                                                 GPIOE->BRR|=1<<5;
  22.                                                 GPIOB->BSRR|=1<<5;
  23.                                                
  24.                         }
  25.        
  26.                                 i++;
  27.                        
  28.                         if(i==20)                        
  29.                         {
  30.                                 i=0;
  31.                                                 GPIOB->BRR|=1<<5;
  32.                                                 GPIOE->BSRR|=1<<5;
  33.                                        
  34.                         }
  35.                                
  36.                                 delay_ms(20);
  37.        
  38.         }



  39. }
復(fù)制代碼

所有資料51hei提供下載:
project9_TIME-TPAD(電容觸摸按鍵).7z (82.91 KB, 下載次數(shù): 36)







歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1