高级会员

- 积分
- 987
- 金钱
- 987
- 注册时间
- 2018-6-20
- 在线时间
- 89 小时
|
1金钱
如题,使用STM32F042F6P6芯片,板子可以确定没问题,用来点亮一个LED,但是来来回回试了很多次都无法成功点亮LED。
程序可以下载进去,Debug发现程序根本没跑起来,不会变化?
源码如下,是哪里还需要再配置吗?
#include <stm32f0xx.h>
void delay(unsigned int time)
{
while(time--);
return;
}
int main()
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_ResetBits(GPIOB, GPIO_Pin_1);
while(1)
{
delay(1000000);
GPIO_ResetBits(GPIOB, GPIO_Pin_1);
delay(1000000);
GPIO_SetBits(GPIOB, GPIO_Pin_1);
}
//return 0;
}
|
|