cancel
Showing results for 
Search instead for 
Did you mean: 

TIM timer period

michael
Associate II
Posted on April 24, 2008 at 18:10

TIM timer period

2 REPLIES 2
michael
Associate II
Posted on May 17, 2011 at 09:52

hello all,

could you show me how I can generate a user clock period of about 100 microseconds, given a PCLK of 48 MHz?

the fastest I can get with this code is 1.36 millisecond ! (of course: 65535/48000000 = 0.00136 second)

Code:

<BR>TIM_StructInit(&l_timer_config) ; <BR> <BR>l_timer_config.TIM_Mode = TIM_OCM_CHANNEL_1 ; <BR>l_timer_config.TIM_OC1_Modes = TIM_TIMING ; <BR>l_timer_config.TIM_Clock_Source = TIM_CLK_APB ; <BR>l_timer_config.TIM_Clock_Edge = TIM_CLK_EDGE_FALLING ; <BR>l_timer_config.TIM_Prescaler = 0x0 ; <BR> <BR>TIM_Init(TIM0, &l_timer_config) ; <BR>

[ This message was edited by: michael.tamir on 24-04-2008 21:14 ]

michael
Associate II
Posted on May 17, 2011 at 09:52

one possibility is to do something like this:

Code:

TIM0->OC1R = TIM0->CNTR + 0x200 ;

which generates a 82474.2 Hz, or 12.12 microsecond.