1 #include "stm32f10x.h"
2
3 void RCC_Configuration(void);
4 void GPIO_Configuration(void);
5
6 u8 dt=0;
7 void delay(u32 nCount)
8 {
9 for(;nCount!=0;nCount--);
10 }
11
12
13 int main(void)
14 {
15 RCC_Configuration();
16 GPIO_Configuration();
17
18
19 while(1)
20 {
21 GPIO_SetBits(GPIOB,GPIO_Pin_12);
22 delay(100000);
23 GPIO_ResetBits(GPIOB,GPIO_Pin_12);
24 delay(12000000);
25 }
26
27 }
28
29 void RCC_Configuration(void)
30 {
31 SystemInit();
32
33 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);
34 }
35 void GPIO_Configuration(void)
36 {
37 GPIO_InitTypeDef GPIO_InitStructure;
38 GPIO_InitStructure.GPIO_Pin=GPIO_Pin_12;
39 GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
40 GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;
41 GPIO_Init(GPIOB,&GPIO_InitStructure);
42 }