![]() |
發布時間: 2022-4-29 15:41
正文摘要:小白求助,謝謝大家 #include "stdio.h" #include "stm32f10x.h" #include "stm32f10x_gpio.h" #include "sys.h" #include "misc.h" uint32_t i; void delay_ms(uint32_t ms) & ... |
忘記了,中斷要寫在stm32f10x_it.c中 |
1:GPIO_EXTILineConfig 中斷IO需要映射 2:中斷端口輸入模式要設定為上拉輸入 GPIO_InitStructure.GPIO_Mode=GPIO_Mode_IPU; 3:RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_AFIO,ENABLE);//使能復用和端口時鐘 我不會用proteus,所以,我從不仿真 |
EXTI_ClearITPendingBit(EXTI_Line2); //清除 LINE 上的中斷標志位 最后一行我復制錯了 清除的是Line0 |
EXTI_ClearITPendingBit(EXTI_Line2); //清除 LINE 上的中斷標志位 |