2008-12-16 08:18 PM
STM32F103RB-timer help
2011-05-17 03:56 AM
Hi,
I need to configure one of the timers of this STM32 board, for purpose of delay of 10 seconds. I used TIM1. I don't know which values ,I should put in the initial structure, I try many values but I didn't get more than 2 seconds delay. Moreover, which flag I should use to recognize when the time over? I am using this init: TIM_TimeBaseStructure.TIM_Prescaler = 30000; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseStructure.TIM_Period = 0x270F; TIM_TimeBaseStructure.TIM_ClockDivision = 0x0; TIM_TimeBaseStructure.TIM_RepetitionCounter = 0x0; TIM_TimeBaseInit(TIM1, &TIM_TimeBaseStructure); /* Channel 1 Configuration in Timing mode TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Timing; TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; TIM_OCInitStructure.TIM_OutputNState = TIM_OutputNState_Disable; TIM_OCInitStructure.TIM_Pulse = 0x0; TIM_OC1Init(TIM1, &TIM_OCInitStructure); after that I enable : TIM_ITConfig(TIM1, TIM_IT_Update, ENABLE); TIM_Cmd(TIM1, ENABLE); I we will be grateful if you could help me,please . example ,or explain how to calculate it. Thanks in Advance, Idan.