2014-09-15 04:56 AM
Hi,
I need to know if it's possible configure TIM1 as timer base (I need interrupt every 5 msec). Thanks2014-09-15 07:53 AM
I need to know if it's possible configure TIM1 as timer base (I need interrupt every 5 msec).
Why wouldn't it be? Factor Prescaler and Period to get 200 Hz from whatever TIMCLK you're using. 24000000 / 200 = 120000 2 * 60000 = 1200002014-09-17 03:24 AM
Hi Clive1,
thanks for reply. I resolved by another way :) . I need to know the interrupt of TIM1 handler (for TIM3 is: TIM3_IRQHandler).2014-09-17 10:16 AM
To understand available interrupts you could review startup_stm32f0xx.s
DCD TIM1_BRK_UP_TRG_COM_IRQHandler ; TIM1 Break, Update, Trigger and Commutation DCD TIM1_CC_IRQHandler ; TIM1 Capture Compare2014-09-17 11:25 PM
Hi clive,
thanks for reply. This is my code; but doesn't work:void TIM1Conf(void){
NVIC_InitTypeDef NVIC_InitStructure;
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1 , ENABLE);
TIM_TimeBaseStructure.TIM_Prescaler = (uint16_t) (((SystemCoreClock / 1000000)/2) - 1);
TIM_TimeBaseStructure.TIM_Period = 10000 - 1;
TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseStructure.TIM_RepetitionCounter = 0;
TIM_TimeBaseInit(TIM1, &TIM_TimeBaseStructure);
TIM_ITConfig(TIM1, TIM_IT_Update, ENABLE);
TIM_Cmd(TIM1, ENABLE);
/* Interrupt Timer1 */
NVIC_ClearPendingIRQ(TIM1_BRK_UP_TRG_COM_IRQn);
NVIC_InitStructure.NVIC_IRQChannel = TIM1_BRK_UP_TRG_COM_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
void TIM1_BRK_UP_TRG_COM_IRQHandler (void){
if(TIM_GetITStatus(TIM1, TIM_IT_Update) != RESET)
{
//
my operations
TIM_ClearITPendingBit(TIM16, TIM_IT_Update);
}
}
2014-09-18 12:15 AM
TIM_ClearITPendingBit(TIM16, TIM_IT_Update);
TIM16 ?