LED函数:
#include "stm32f4xx.h"
#include "led.h"
//#include "stm32f4xx_gpio.h"
//#include "stm32f4xx_rcc.h"
void LED_GPIO_Config(void)
{
GPIO_InitTypeDef GPIO_InitStruct;
RCC_AHB1PeriphClockCmd (RCC_AHB1Periph_GPIOB,ENABLE);
GPIO_InitStruct.GPIO_Pin= GPIO_Pin_5;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_UP;
/*GPIO_InitStruct.GPIO_Pin= GPIO_Pin_5;
GPIO_Init(GPIOB,&GPIO_InitStruct);*/
GPIO_InitStruct.GPIO_Pin= GPIO_Pin_6;
GPIO_Init(GPIOB,&GPIO_InitStruct);
//GPIO_SetBits(GPIOB, GPIO_Pin_5 | GPIO_Pin_6);
}
#include "stm32f4xx.h"
//#include "stm32f4xx_gpio.h"
#include "led.h"
static void Delay(__IO uint32_t nCount);
//void LED_GPIO_Config(void);
main函数:
int main(void)
{
RCC->CR = 0X00010000;
LED_GPIO_Config();
while(1)
{
GPIO_ResetBits(GPIOB,GPIO_Pin_5);
Delay(0x1fffff);
GPIO_SetBits(GPIOB,GPIO_Pin_5);
Delay(0x1fffff);
GPIO_ResetBits(GPIOB,GPIO_Pin_6);
Delay(0x1fffff);
GPIO_SetBits(GPIOB,GPIO_Pin_6);
Delay(0x1fffff);
}
}
static void Delay(__IO uint32_t nCount)
{
while(nCount--)
{
}
}
然后就这样了,如下:
/* Wait till HSE is ready and if Time out is reached exit */
do
{
HSEStatus = RCC->CR & RCC_CR_HSERDY;
StartUpCounter++;
} while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
调试时一直在这里死循环,那位大神指导指导。
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
要不然你把那句删掉试试
------------------------
原子哥,是我粗心大意了 ,系统时钟配置的超频了。额!重新配置好就ok了。
一周热门 更多>