(4)GPIO_Mode_IPU 上拉输入 (5)GPIO_Mode_Out_OD 开漏输出 (6)GPIO_Mode_Out_PP 推挽输出 (7)...
//定义PA8,GPIO设置 GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP; //推挽输出 GPIO_InitStructure....
GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOE, ENABLE); //使能PB,PE端口时钟 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Pin = LED0_PIN; GPIO_Init(LED0_P...
推挽输出(GPIO_Mode_Out_PP):这种输出方式比较常用,它是完全可以正常的输出高低电平的输出模式。当需要输出高电平时,上面的P-MOS管导通,此时D点的电压就是VDD点的电压,也就是我们常说的输出1。 当需要输出低电平时,下面的N-MOS管导通,此时D点的电压就是VSS点的电压,也就是我们常说的输出0。
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOC, &GPIO_InitStructure); //通过循环让灯闪烁 while (aa){ GPIO_SetBits(GPIOC,GPIO_Pin_3); delay_us(100000); GPIO_ResetBits(GPIOC,GPIO_Pin_3); delay_us(100000);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;/*设置引脚速率为50MHz */GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;/*调用库函数,初始化GPIO*/GPIO_Init(LED1_GPIO_PORT, &GPIO_InitStructure);/*选择要控制的GPIO引脚*/GPIO_InitStructure.GPIO_Pin = LED2_GPIO_PIN;/*调用库函数,初始化GPIO...
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;GPIO_Init(GPIOA, &GPIO_InitStructure);} ```## 2.定时器TIM3配置 接下来我们以通用定时器TIM3为实例,来说明要经过哪些步骤,才能达到这个要求,并产生中断。1)TIM3时钟使能。这里我们通过APB1ENR的第1...
GPIO_Mode_Out_PP = 0x10,//推挽输出模式 GPIO_Mode_AF_OD = 0x1C,//复用功能的开漏输出模式 GPIO_Mode_AF_PP = 0x18//复用功能的推挽输出模式 }GPIOMode_TypeDef; 2、GPIO初始化 通过系统模块图可以发现,所有的GPIO都处于APB2通道上的。所以要使用GPIO必须对APB2进行的相关设置。主要设置如下: ...
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; // 推挽输出 GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; // 速度配置 GPIO_Init(GPIOA, &GPIO_InitStruct); 根据具体需求选择合适的模式,并参考数据手册(如STM32F103xx Reference Manual)确认引脚复用功能。
void Init_ADS1256_GPIO(void) { GPIO_InitTypeDef GPIO_InitStructure; RCC_APB2PeriphClockCmd(RCC_ADS1256Reset | RCC_ADS1256DRDY, ENABLE); //复位等待IO时钟使能 GPIO_InitStructure.GPIO_Pin = GPIO_RCC_ADS1256Reset; GPIO_I