本篇博文最後修改時間: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 :[email protected]
懵懂之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****/