申请了stm32f410的开发板下载了程序怎么灯不会亮啊,求大.....
本人刚开始学stm32申请了块stm32f410的开发板写了个用i/o口点灯的程序,程序也烧录进去了为什么灯不亮啊,程序是仿照正点原子f4开发板写的请大家帮忙看看。程序如下:#include "stm32f4xx.h"#include "LED.h"
#include "delay.h"
int main()
{
delay_init(168);
LED_init();
while(1)
{
GPIO_SetBits(GPIOA,GPIO_Pin_2);
GPIO_SetBits(GPIOA,GPIO_Pin_3);
delay_ms(500);
GPIO_ResetBits(GPIOA,GPIO_Pin_2);
GPIO_ResetBits(GPIOA,GPIO_Pin_3);
delay_ms(500);
}
}
5265325 发表于 2016-11-29 23:53
你要把LED初始化程序和原理图贴出来看看
#include "LED.h"
#include "stm32f4xx.h"
void LED_init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOC,ENABLE);
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_2;
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType=GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd=GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(GPIOA,&GPIO_InitStructure);
GPIO_SetBits(GPIOA,GPIO_Pin_2);
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_3;
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType=GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd=GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(GPIOA,&GPIO_InitStructure);
GPIO_SetBits(GPIOA,GPIO_Pin_3);
}
你要把LED初始化程序和原理图贴出来看看 查看qh部晶振配置对不对,你的IO口配置对不对 貌似时钟没有初始化 看看正点的教程吧。这个肯定附送很多例子的。 LED_init();
贴出来看看呀 程序应该不会就这么点的吧 缺少初始化文件; 是有那个CubeMX,方便的; 恩初始化!