cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103RB-timer help

mertzer2
Associate
Posted on December 17, 2008 at 05:18

STM32F103RB-timer help

1 REPLY 1
mertzer2
Associate
Posted on May 17, 2011 at 12:56

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.