请朋友们给指点一下,我的设置如下:
/* RCC system reset(for debug purpose) */
RCC_DeInit();
//RCC_LSICmd(ENABLE); //内部时钟开启
/* Enable HSE */
RCC_HSEConfig(RCC_HSE_ON);
/* Wait till HSE is ready */
HSEStartUpStatus = RCC_WaitForHSEStartUp();
//if(HSEStartUpStatus == SUCCESS)
//{
/* Enable Prefetch Buffer */
FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
/* Flash 2 wait state */
FLASH_SetLatency(FLASH_Latency_1);
/* HCLK = SYSCLK */
RCC_HCLKConfig(RCC_SYSCLK_Div1);
/* PCLK2 = HCLK */
RCC_PCLK2Config(RCC_HCLK_Div1);
/* PCLK1 = HCLK/2 */
RCC_PCLK1Config(RCC_HCLK_Div2);
if(HSEStartUpStatus == SUCCESS)
{
/* PLLCLK = 8MHz * 4 = 72 MHz */
RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
}
else
{
HSE_ERROR=1; //置外部晶振错误标记
//RCC_PLLConfig(RCC_PLLSource_HSI_Div2, RCC_PLLMul_8); //4*8 =32M
RCC_PLLConfig(RCC_PLLSource_HSI_Div2, RCC_PLLMul_16); //4*16 =64M
}
/* Enable PLL */
RCC_PLLCmd(ENABLE);
/* Wait till PLL is ready */
while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
{
}
/* Select PLL as system clock source */
RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
/* Wait till PLL is used as system clock source */
while(RCC_GetSYSCLKSource() != 0x08)
{
}
//}
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);
//使能PWR以及备份时钟域
RCC_APB1PeriphClockCmd(/*RCC_APB1Periph_USART3 |*/ RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, DISABLE);
/* Enable USART1, GPIOA, GPIOB, GPIOC, GPIOD, GPIOE and AFIO clocks */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |RCC_APB2Periph_GPIOC
| RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE);
/* Enable USART2 clock */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
/* TIM1 clocks enable */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, DISABLE);
/* TIM2 clocks enable */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
/* TIM3 clocks enable */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);
/* TIM4 clocks enable */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE);
}
void GPIO_init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
//IO Y0 Y1,Y2,Y3
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12|GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;//GPIO_Mode_Out_OD;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure);
}
首先要谢谢,香老板的回答,不输出的原因找到了,定义变量时将之定义为输入寄存器上了,我改为输出寄存器定义就好了