如图
//TIM6 10msË¢DÂ
TIM_TimeBaseStructure.TIM_Prescaler = 84;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseStructure.TIM_Period = 10000;
TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1;
TIM_TimeBaseInit(TIM6,&TIM_TimeBaseStructure);
TIM_ITConfig(TIM6,TIM_IT_Update,ENABLE);
//TIM_ARRPreloadConfig(TIM6,ENABLE);
TIM_Cmd(TIM6, ENABLE);
NVIC_InitStructure.NVIC_IRQChannel = TIM6_DAC_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 4;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
void TIM6_DAC_IRQHandler(void)
{
if(TIM_GetFlagStatus(TIM6,TIM_FLAG_Update)!=RESET)
{
Test_Number_TIM6++;
TIM_ClearFlag(TIM6,TIM_FLAG_Update);
}
}
进不了中断
然后 TIM6_DAC_IRQn; 为什么要加一个DAC啊
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>