哈哈,这么晚了。
也被申请通过了呵。
测试C语言呵。
/* *********************** ********** ***********************
>File: main.c
>Author: dmg
>Creatdate: 2011-03-28
+Description:
+Modifydate: (None)
-Ver: 1.0
-Note: (None)
*********************** ********** *********************** */
// ----> include files block <----
//eg. #include <stdio.h>
#include <stdio.h>
#include "stm32f10x.h"
// ----> macros block <----
//eg. #define DEBUG 1
// ----> variables define block <----
//eg. int ivar=0;
// ----> declarations block <----
//eg. extern int himan(int dmgslot);
// ----> functions define block <----
//eg. int main(void);
//= ======================= ********** =======================
// >Function: void delay_nn(__IO uint32_t nTime);
// >Creatdate: 2010-03-07 - dmg
// +Parameters:
// -void
// +Return: -void:
// +Description:
//= ======================= ********** =======================
void delay_nn(__IO uint32_t nTime)
{
__IO uint32_t i,j;
for(i=0; i<nTime; i++)
for(j=0; j<2350; j++) ;
}
//= ======================= ********** =======================
// >Function: void Periphs_init(void);
// >Creatdate: 2010-03-07 - dmg
// +Parameters:
// -void
// +Return: -void:
// +Description:
//= ======================= ********** =======================
void Periphs_init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
USART_InitTypeDef USART_InitStructure;
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB |
RCC_APB2Periph_USART1, ENABLE);
//LEDS
//LED1-PB0; LED1-PB1
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOB, &GPIO_InitStructure);
//USART1
//USART1:TX-PA9; USART1:RX-PA10
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOA, &GPIO_InitStructure);
USART_InitStructure.USART_BaudRate = 115200;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;
USART_Init(USART1, &USART_InitStructure);
USART_Cmd(USART1, ENABLE);
}
//= ======================= ********** =======================
// >Function: int main(void);
// >Creatdate: 2010-03-28 - dmg
// +Parameters:
// -void
// +Return: -void:
// +Description:
//= ======================= ********** =======================
int main(void)
{
Periphs_init();
GPIO_SetBits(GPIOB, GPIO_Pin_0);
GPIO_SetBits(GPIOB, GPIO_Pin_1);
delay_nn(200);
delay_nn(200);
while(1) {
GPIO_ResetBits(GPIOB, GPIO_Pin_1);
delay_nn(500);
GPIO_SetBits(GPIOB, GPIO_Pin_1);
delay_nn(500);
}
return 0;
}