Keil5.23之STM32F103RC创建工程

来源:互联网 发布:东莞seo公司 编辑:程序博客网 时间:2024/06/03 16:56



本篇博文最后修改时间:2017年08月23日 13:30。


一、简介

本文Keil5.23创建工程为例,介绍Keil5.23如何创建STM32F103RC工程。




二、实验平台

电脑平台:Windows7 64位旗舰

编译软件:Keil5.23

硬件平台:STM32F103RC




三、版权声明

博主:_懵懂

声明:此博客仅供参考不做任何商业用途,最终解释权归原博主所有。

原文地址:http://blog.csdn.NET/qq_18842031

QQ:951795235

E-mail :951795235@qq.com

懵懂之MCU交流群:136384801




四、实验前提

1、在进行本文步骤前,请先安装Keil5.23版本;准备好STM32F103RC硬件平台。

         


五、基础知识

暂无



六、源码地址

暂无


七、关联文章

暂无



八、实验内容

1.Keil5新建STM32F103RC项目


























第二十六步输入 USE_STDPERIPH_DERIVER 



2.项目Dome引脚电频翻转

#include"stm32f10x.h"GPIO_InitTypeDef GPIO_InitStructure;ErrorStatus HSEStartUpStatus;void RCC_Configuration(void);void NVIC_Configuration(void);void Delay(vu32 nCount);int main(void){#ifdef DEBUG  debug();#endif  RCC_Configuration();     NVIC_Configuration();  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO, ENABLE);//  GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE);    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;   GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;   GPIO_Init(GPIOA, &GPIO_InitStructure);    GPIO_Init(GPIOB, &GPIO_InitStructure);    while (1)  {   GPIO_Write(GPIOA, 0x00ff); Delay(0x8FFFFF); //GPIO_Write(GPIOA, 0xff00);Delay(0x8FFFFF); //   }}/********************************************************************************                          *******************************************************************************/void RCC_Configuration(void){     RCC_DeInit(); //?RRC????????  RCC_HSEConfig(RCC_HSE_ON);  HSEStartUpStatus = RCC_WaitForHSEStartUp();  if(HSEStartUpStatus == SUCCESS)     {            FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);       FLASH_SetLatency(FLASH_Latency_2);       RCC_HCLKConfig(RCC_SYSCLK_Div1);         RCC_PCLK2Config(RCC_HCLK_Div1);         RCC_PCLK1Config(RCC_HCLK_Div2);        RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);       RCC_PLLCmd(ENABLE);      while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)    {    }     RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);       while(RCC_GetSYSCLKSource() != 0x08)    {    }  }}/********************************************************************************                           *******************************************************************************/void NVIC_Configuration(void){#ifdef  VECT_TAB_RAM    /* Set the Vector Table base location at 0x20000000 */   NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0); #else  /* VECT_TAB_FLASH  */  /* Set the Vector Table base location at 0x08000000 */   NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);   #endif}/********************************************************************************                              ????*******************************************************************************/void Delay(vu32 nCount){  for(; nCount != 0; nCount--);}#ifdef  DEBUG/******************************************************************************** Function Name  : assert_failed* Description    : Reports the name of the source file and the source line number*                  where the assert_param error has occurred.* Input          : - file: pointer to the source file name*                  - line: assert_param error line source number* Output         : None* Return         : None*******************************************************************************/void assert_failed(u8* file, u32 line){   /* User can add his own implementation to report the file name and line number,     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */  /* Infinite loop */  while (1)  {  }}#endif/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/





原创粉丝点击