|
一個(gè)最簡(jiǎn)單的stm32程序,實(shí)現(xiàn)的功能是使用位帶來(lái)實(shí)現(xiàn)LED燈的閃爍,新人,第一次發(fā)稿,求指導(dǎo)!
單片機(jī)源程序如下:
- #include "led.h"
- void LED_Init()
- {
- GPIO_InitTypeDef GPIO_InitStructure;//定義結(jié)構(gòu)體變量
-
- RCC_APB2PeriphClockCmd(LED_PORT_RCC,ENABLE);
-
- GPIO_InitStructure.GPIO_Pin=LED_PIN; //選擇你要設(shè)置的IO口
- GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP; //設(shè)置推挽輸出模式
- GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz; //設(shè)置傳輸速率
- GPIO_Init(LED_PORT,&GPIO_InitStructure); /* 初始化GPIO */
-
- GPIO_SetBits(LED_PORT,LED_PIN); //將LED端口拉高,熄滅所有LED
- }
復(fù)制代碼
所有資料51hei提供下載:
LED閃爍(使用位帶操作).7z
(171.86 KB, 下載次數(shù): 25)
2019-5-29 04:40 上傳
點(diǎn)擊文件名下載附件
實(shí)驗(yàn)程序 下載積分: 黑幣 -5
|
評(píng)分
-
查看全部評(píng)分
|