INTERRUPT_HANDLER( TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11 )
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
TIM1_ClearITPendingBit( TIM1_IT_UPDATE );
time1_num--;
if( 0 == time1_num )
{
TIM1_Cmd( DISABLE );
time1_Flag = 1;
}
}
{
// 16分频 16M/(0x0f+1)=1M CNTR计数一次为 1/1M=1us 定时1000us
TIM1_TimeBaseInit( 0x0f, TIM1_COUNTERMODE_UP, 1000, 0 );
TIM1_ClearFlag( TIM1_FLAG_UPDATE );
TIM1_ITConfig( TIM1_IT_UPDATE, ENABLE ); // 使能更新中断
enableInterrupts(); // 使能全局中断
}
INTERRUPT_HANDLER( TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11 )
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
TIM1_ClearITPendingBit( TIM1_IT_UPDATE );
time1_num--;
if( 0 == time1_num )
{
TIM1_Cmd( DISABLE );
time1_Flag = 1;
}
}
一周热门 更多>