56 lines
1.1 KiB
Plaintext
56 lines
1.1 KiB
Plaintext
1.实验目的:
|
||
新建基于STM32F4 固件库V1.3.0的工程模板
|
||
|
||
2.实验现象:
|
||
下载进开发板之后,红绿灯闪烁
|
||
|
||
3.注意事项:
|
||
|
||
1)新建工程的时候,请确保Option for target->C/C++选项卡的全部宏定义Define输入框字符串为:STM32F40_41xxx,USE_STDPERIPH_DRIVER
|
||
|
||
|
||
4.手册中讲解到步骤15的时候的main.c源码如下:
|
||
|
||
|
||
|
||
|
||
|
||
#include "stm32f4xx.h"
|
||
|
||
|
||
//ALIENTEK 探索者STM32F407开发板 实验0
|
||
//STM32F4工程模板-库函数版本
|
||
//技术支持:www.openedv.com
|
||
//淘宝店铺:http://eboard.taobao.com
|
||
//广州市星翼电子科技有限公司
|
||
//作者:正点原子 @ALIENTEK
|
||
|
||
void Delay(__IO uint32_t nCount);
|
||
|
||
void Delay(__IO uint32_t nCount)
|
||
{
|
||
while(nCount--){}
|
||
}
|
||
|
||
int main(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);
|
||
|
||
while(1){
|
||
GPIO_SetBits(GPIOF,GPIO_Pin_9|GPIO_Pin_10);
|
||
Delay(0x7FFFFF);
|
||
GPIO_ResetBits(GPIOF,GPIO_Pin_9|GPIO_Pin_10);
|
||
Delay(0x7FFFFF);
|
||
|
||
}
|
||
}
|