利用我這個程序教你入門STm32F103 單片機寄存器版的第二步
單片機源程序如下:
- #include "stm32f10x.h"
- #include "delay.h"
- #include "sys.h"
- #include "key.h"
- int main()
- {
- Stm32_Clock_Init(9);
- delay_init(72);
- Key_Init();
-
- while(1)
- {
-
- if((GPIOE->IDR&(1<<2))==0)
- {
- GPIOE->BRR|=1<<5;
- delay_ms(500);
- GPIOE->BSRR|=1<<5;
- delay_ms(500);
-
-
-
- }
-
-
- if((GPIOE->IDR&(1<<3))==0)
- {
- GPIOE->BRR|=1<<5;
- delay_ms(500);
- GPIOE->BSRR|=1<<5;
- delay_ms(500);
-
-
-
- }
-
-
-
-
- }
- }
復制代碼
所有資料51hei提供下載:
project2_KEY.7z
(78.69 KB, 下載次數: 6)
2020-3-31 00:37 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
|