#include"stm32f10x.h"
GPIO_InitTypeDef GPIO_InitStructure;
void RCC_Configuration(void);
void GPIO_Config(void);
void Delay(__IO uint32_t nCount);
int main(void)
{
RCC_Configuration();
GPIO_Config ();
while(1)
{
GPIO_SetBits(GPIOA, GPIO_Pin_5);
GPIO_SetBits(GPIOB, GPIO_Pin_6);
GPIO_SetBits(GPIOB, GPIO_Pin_3);
Delay(0xAFFFF);
GPIO_ResetBits(GPIOA, GPIO_Pin_5);
GPIO_ResetBits(GPIOB, GPIO_Pin_6);
GPIO_ResetBits(GPIOB, GPIO_Pin_3);
}
}
void RCC_Configuration(void)
{
SystemInit();
}
//yanshihanshu
void Delay(__IO uint32_t nCount)
{
for(;nCount !=0;nCount--);
}
//
void GPIO_Config(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOB, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6|GPIO_Pin_3;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6|GPIO_Pin_3;
GPIO_Init(GPIOB, &GPIO_InitStructure);
}
|