打印
[应用相关]

哪位能帮忙找个错?

[复制链接]
1176|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
huangfeng33|  楼主 | 2012-9-25 22:04 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
哪位能帮忙找个错?下到板子上没反应。

  RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);   // PLLCLK = 8MHz * 9 = 72 MHz
     RCC_PLLCmd(ENABLE);            // Enable PLL
     while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
     {
      ;               // Wait till PLL is ready
     }

      RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);      // Select PLL as system clock source
     while (RCC_GetSYSCLKSource() != 0x08)       // Wait till PLL is used as system clock source
     {
      ;
     }
  }
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE);
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD,ENABLE);
}
void GPIO_Configration(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
   GPIO_InitStructure.GPIO_Pin =GPIO_Pin_10;
    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_9;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
    GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin =GPIO_Pin_2;
    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
    GPIO_Init(GPIOD, &GPIO_InitStructure);

}
void NVIC_Configration(void)
{
#ifdef VECT_TAB_RAM
NVIC_SetVectorTable(NVIC_VectTab_RAM,0x0);
#else
NVIC_SetVectorTable(NVIC_VectTab_FLASH,0x0);
  #endif
}
void USART_Configration(void)
{
USART_InitTypeDef USART_InitStructure;
USART_InitStructure.USART_BaudRate=56000;
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_Rx|USART_Mode_Tx;
USART_Init(USART1,&USART_InitStructure);
USART_Cmd(USART1,ENABLE);
}

void delay(u32 z)
{
u32 x,y;
for(x=z;x>0;x--)
for(y=1100;y>0;y--);
}
PUTCHAR_PROTOTYPE
{
  /* Place your implementation of fputc here */
  /* e.g. write a character to the USART */
  USART_SendData(USART1, (uint8_t) ch); /*发送一个字符函数*/
  /* Loop until the end of transmission */
  while (USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET)/*等待发送完成*/
  {
  
  }
  return ch;
}
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

506

主题

2446

帖子

8

粉丝