Skip to main content
Visitor II
April 24, 2008
Question

TIM timer period

  • April 24, 2008
  • 2 replies
  • 660 views
Posted on April 24, 2008 at 18:10

TIM timer period

    This topic has been closed for replies.

    2 replies

    michaelAuthor
    Visitor II
    May 17, 2011
    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 ]

    michaelAuthor
    Visitor II
    May 17, 2011
    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.