stm32f103精英版点灯
时间: 2023-09-22 08:07:10 浏览: 101
要在STM32F103精英版上进行点灯操作,可以使用以下代码:
```c
#include "stm32f10x.h"
int main(void) {
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); // 打开GPIOC的时钟
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; // 输出模式
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_13; // 使用PC13引脚
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; // 设置引脚速度为50MHz
GPIO_Init(GPIOC, &GPIO_InitStruct); // 初始化GPIOC
while(1) {
GPIO_SetBits(GPIOC, GPIO_Pin_13); // 将PC13引脚置高,点亮LED
}
}
```
在这段代码中,首先打开了GPIOC的时钟,并进行了相应的初始化配置。然后,在while循环中,通过调用`GPIO_SetBits`函数将PC13引脚置高,从而点亮LED。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [毕设项目:基于zigbee和stm32的智能家居系统,上位机使用Qt编写.zip](https://download.csdn.net/download/qq_35831906/88258947)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [STM32F103系列之点灯操作](https://blog.csdn.net/bshysy1314/article/details/128496244)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文