stm32点亮灯(2023/7/18)

jlxaiyjx / 2023-07-19 / 原文

#include "stm32f10x.h" // Device header
int main(void)
{
RCC_APB1PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);//设置时钟
GPIO_InitTypeDef GPIO_InitStructure;//初始化的宏定义
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;//设置推挽模式
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_13;//打开13脚,自带的led灯
GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;//一般情况下都是50HZ
GPIO_Init(GPIOC,&GPIO_InitStructure);//初始化函数调用
//GPIO_SetBits(GPIOC,GPIO_Pin_13);//引脚高电平设置
GPIO_ResetBits(GPIOC,GPIO_Pin_13);//引脚低电平设置
while(1)
{

}
}

 输出结果显示