關于STM32F030的具體模板,共開發者參考
0.png (41.11 KB, 下載次數: 53)
下載附件
2018-10-10 15:00 上傳
單片機源程序如下:
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /*
- STM32F030C8T6模板
- 時鐘都在system_stm32f0xxx.里設定。用那個開那個,輸出都是48MHZ,最大頻率,可以在里面改變大小頻率
- #define PLL_SOURCE_HSI // HSI (~8MHz) used to clock the PLL, and the PLL is used as system clock source(~ 8MHz)
- //#define PLL_SOURCE_HSE // HSE (8MHz) used to clock the PLL, and the PLL is used as system clock source
- //#define PLL_SOURCE_HSE_BYPASS // HSE bypassed with an external clock (8MHz, coming from ST-Link) used to clock
-
- 使用內部時鐘 48MHZ
- */
- #include "stm32f0xx.h"
- #include "delay.h"
- void LedInit(void)
- {
- GPIO_InitTypeDef GPIO_InitStructure;
- RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA,ENABLE); //GPIOF時鐘打開
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; //模式:輸出
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; //輸入類型:上拉/下拉/無
- GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; //輸出類型:推挽輸出
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //輸出速率
- GPIO_Init(GPIOA,&GPIO_InitStructure);
- }
- int main(void)
- {
- delay_init();///定時器初始化,
- LedInit();///LED燈初始代,
-
- while (1)
- {
- GPIO_ResetBits(GPIOA,GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2);
- delay_ms(200); //延時
- GPIO_SetBits(GPIOA,GPIO_Pin_0|GPIO_Pin_1|GPIO_Pin_2);
- delay_ms(200);
- }
- }
復制代碼
所有資料51hei提供下載:
工程模板-F030.zip
(297.96 KB, 下載次數: 222)
2018-10-10 12:43 上傳
點擊文件名下載附件
STM32F030 下載積分: 黑幣 -5
|