标签:保存 reset 不用 enable type startup 重要 add 自己
1.创建模板主目录Template,在主目录下添加5个子文件夹(USER,CORE,FWLIB,SYSTEM,OBJ)
2.创建项目,打开keil,菜单选择project->new uVision project
项目保存路径为Template/USER,项目名称为Template
选择自己开发的相应芯片,我是用的是STM32F407ZG, 点击ok 点击Cancel
3..添加STM32库函数
将函数库目录下\STM32F4xx_DSP_StdPeriph_Lib_V1.4.0\Libraries\STM32F4xx_StdPeriph_Driver 中的src与inc复制到FWLIB文件夹中
#include "stm32f4xx.h"
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);
} }
标签:保存 reset 不用 enable type startup 重要 add 自己
原文地址:https://www.cnblogs.com/xwcs/p/13062180.html