
#include "stm32f10x.h" // Device header
#include "Delay.h"
int main()
{
//1.使用RCC开启GPIO的时钟
//调用RCC里面的APB2外设时钟控制函数
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);
//2.使用GPIO_Init初始函数初始化GPIO
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.GPIO_Mode=GPIO_Mode_Out_PP ;
GPIO_InitStruct.GPIO_Pin= GPIO_Pin_All;
GPIO_InitStruct.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(GPIOA,&GPIO_InitStruct);
//3.使用输出或者输入的函数控制GPIO口
//高电平
//GPIO_SetBits(GPIOA,GPIO_Pin_0);
//低电平
//GPIO_ResetBits(GPIOA,GPIO_Pin_0);
while(1)
{
GPIO_Write(GPIOA,~0x0001);
Delay_ms(100);
GPIO_Write(GPIOA,~0x0002);
Delay_ms(100);
GPIO_Write(GPIOA,~0x0004);
Delay_ms(100);
GPIO_Write(GPIOA,~0x0008);
Delay_ms(100);
GPIO_Write(GPIOA,~0x0010);
Delay_ms(100);
GPIO_Write(GPIOA,~0x0020);
Delay_ms(100);
GPIO_Write(GPIOA,~0x0040);
Delay_ms(100);
GPIO_Write(GPIOA,~0x0080);
Delay_ms(100);
}
}