jlxaiyjx

导航

stm32点亮灯(2023/7/18)

#include "stm32f10x.h" // Device header
int main(void)
{
RCC_APB2PeriphClockCmd(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_WriteBit(GPIOC,GPIO_Pin_13,Bit_SET);赋值引脚高电平,和GPIO_SetBits(GPIO,GPIO_Pin_13)具有相同的使用效果
GPIO_ResetBits(GPIOC,GPIO_Pin_13);//引脚低电平设置

//GPIO_WriteBit(GPIOC,GPIO_Pin_13,Bit_RESET);引脚赋值低电平
while(1)
{
}

}

 

 

 输出结果显示

 

posted on 2023-07-18 21:32  蒋果是果  阅读(19)  评论(0编辑  收藏  举报