![]() |
發(fā)布時間: 2021-11-25 22:54
正文摘要:stm32f103c8t6最小版:想讓PC13的LED燈閃爍,但加了GPIO_ResetBits(GPIOC, GPIO_Pin_13);之后就常亮,不加它,即使復位也不亮,求各位大俠幫助,謝謝。代碼如下: testLed.c: #include "Init.h" ... |
謝謝各位大俠,問題已解決。原因是我將核心板上的PC13當成了C13 |
#define LED_PORT GPIOC #define LED_PIN (GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2|GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7|GPIO_Pin_13|GPIO_Pin_15) #define LED_PORT_RCC RCC_APB2Periph_GPIOC |
GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(LED_PORT_RCC,ENABLE); GPIO_InitStructure.GPIO_Pin=LED_PIN; GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz; GPIO_Init(LED_PORT,&GPIO_InitStructure); |
Powered by 單片機教程網(wǎng)