標(biāo)題: 利用我這個(gè)程序教你入門STm32F103單片機(jī)寄存器版的第二步 [打印本頁(yè)]

作者: 書眉間清風(fēng)    時(shí)間: 2020-3-30 22:47
標(biāo)題: 利用我這個(gè)程序教你入門STm32F103單片機(jī)寄存器版的第二步
利用我這個(gè)程序教你入門STm32F103 單片機(jī)寄存器版的第二步

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







  5. int main()
  6. {
  7.         Stm32_Clock_Init(9);
  8.         delay_init(72);
  9.          Key_Init();
  10.        
  11.                 while(1)
  12.                 {
  13.                                
  14.                                 if((GPIOE->IDR&(1<<2))==0)
  15.                                 {
  16.                                                 GPIOE->BRR|=1<<5;
  17.                                                 delay_ms(500);
  18.                                                 GPIOE->BSRR|=1<<5;
  19.                                                 delay_ms(500);
  20.                                
  21.                                
  22.                                
  23.                                 }
  24.                
  25.                                
  26.                                 if((GPIOE->IDR&(1<<3))==0)
  27.                                 {
  28.                                                 GPIOE->BRR|=1<<5;
  29.                                                 delay_ms(500);
  30.                                                 GPIOE->BSRR|=1<<5;
  31.                                                 delay_ms(500);
  32.                                
  33.                                
  34.                                
  35.                                 }
  36.                                
  37.                                
  38.                                
  39.                
  40.                 }







  41. }
復(fù)制代碼

所有資料51hei提供下載:
project2_KEY.7z (78.69 KB, 下載次數(shù): 6)






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