2008-04-24 09:10 AM
2011-05-17 12:52 AM
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 ]2011-05-17 12:52 AM
one possibility is to do something like this:
Code:
TIM0->OC1R = TIM0->CNTR + 0x200 ; which generates a 82474.2 Hz, or 12.12 microsecond.