开通博客~

哈哈,这么晚了。

也被申请通过了呵。

测试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 ;

}

转载于:https://www.cnblogs.com/dmgslot/archive/2011/03/29/1999329.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值