推挽模式下,高低电平均有推挽模式PP
开漏模式下,高电平没有驱动能力
#include "stm32f10x.h" // Device header
#include "Delay.h"
int main (void) // main函数是一个int型返回值,void参数的函数
{
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA,ENABLE);//开启寄存器的时钟
GPIO_InitTypeDef GPIO_Initstructure;
GPIO_Initstructure.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_Initstructure.GPIO_Pin=GPIO_Pin_0;
GPIO_Initstructure.GPIO_Speed=GPIO_Speed_50MHz;//至此结构体的定义完成!
GPIO_Init(GPIOA,&GPIO_Initstructure);
// GPIO_ResetBits(GPIOA,GPIO_Pin_0);
while(1)
{ GPIO_SetBits(GPIOA,GPIO_Pin_0);
Delay_ms(10);
GPIO_ResetBits(GPIOA,GPIO_Pin_0);
Delay_ms(10);
GPIO_WriteBit(GPIOA,GPIO_Pin_0,Bit_RESET);
Delay_ms(5000);
GPIO_WriteBit(GPIOA,GPIO_Pin_0,Bit_SET);
Delay_ms(5000);
}
}