stm32f103 定时器中断IO口输出问题

2019-10-16 00:37发布

void tim_NVIC_Configuration()
{
  NVIC_InitTypeDef NVIC_InitStructure;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0);
NVIC_InitStructure.NVIC_IRQChannel=time_IRQ;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority=3;
NVIC_InitStructure.NVIC_IRQChannelCmd=ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
void tim_Configuration()
{
TIM_TimeBaseInitTypeDef  TIM_TimeBaseStructure;
RCC_APB1PeriphClockCmd(time_CLK,ENABLE);
TIM_TimeBaseStructure.TIM_Period=9;
TIM_TimeBaseStructure.TIM_Prescaler=0;
TIM_TimeBaseInit(time,&TIM_TimeBaseStructure);
TIM_ClearFlag(time,TIM_FLAG_Update);
TIM_ITConfig(time,TIM_IT_Update,ENABLE);
TIM_Cmd(time,ENABLE);
}
void GPIO_Configuration()
{

GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(GPIO_CLK, ENABLE);  
  GPIO_InitStructure.GPIO_Pin=GPIO_PIN;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(OutGPIO,&GPIO_InitStructure);
}
通过基本定时器实现在定时器中断中对GPIOE管脚输出一个方波,输出的方波按照计算应该是3.6MHz,但是示波器观测到的波形只有600kHz,那位大神能够指导一下!
而且波形也有很大的毛刺

0条回答

一周热门 更多>