![]() |
發布時間: 2021-3-26 15:53
正文摘要:#include"stm32f0xx.h" #include"LED.h" void Delay(void) { unsigned int i; for(i=0;i<0x003fffff;i++); } i ... |
Delay()函數,變量i定義為16位,i不可能達到0x003fffff這個值。for(i=0;i<0x003fffff;i++)是錯誤的 |
靜態變量申明問題,前面的一個_I是什么?去掉試試 |
#ifndef __LED_H #define __LED_H #include"stm32f0xx.h" void LED_Init(void); #endif |
#include"stm32f0xx.h" #include"LED.h" void LED_Init(void) { GPIO_InitTypeDef GPIO_InitStruct; RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA,ENABLE); GPIO_InitStruct.GPIO_Pin=GPIO_Pin_3; GPIO_InitStruct.GPIO_Mode=GPIO_Mode_OUT; GPIO_InitStruct.GPIO_OType=GPIO_OType_PP; GPIO_InitStruct.GPIO_Speed=GPIO_Speed_Level_3; GPIO_Init(GPIOA,&GPIO_InitStruct); GPIO_SetBits(GPIOA,GPIO_Pin_3); } |
錯誤都調試過了 |