新手上路
- 积分
- 29
- 金钱
- 29
- 注册时间
- 2016-7-23
- 在线时间
- 5 小时
|
2金钱
本帖最后由 xiaolin320560 于 2016-9-2 15:20 编辑
ALIENTEK探索者STM32F4开发板,我自己新建的工程,编写了一个跑马灯程序,延时500ms闪烁一次,结果下载到板子上延时变成了至少3S闪一次,这是为什么呢,实在找不出问题了。求指教
#include "led.h"
#include "stm32f4xx.h"
void LED_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOF, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_Init(GPIOF, &GPIO_InitStructure);
GPIO_SetBits(GPIOF,GPIO_Pin_9 | GPIO_Pin_10);
}
#include "stm32f4xx.h"
#include "usart.h"
#include "delay.h"
#include "led.h"
int main(void)
{
delay_init(168);
LED_Init();
while(1){
GPIO_SetBits(GPIOF,GPIO_Pin_9|GPIO_Pin_10);
delay_ms(500);
GPIO_ResetBits(GPIOF,GPIO_Pin_9|GPIO_Pin_10);
delay_ms(500);
}
}
|
|