cancel
Showing results for 
Search instead for 
Did you mean: 

Timer Prescaler Value?

jmcallister
Associate II
Posted on October 13, 2006 at 12:30

Timer Prescaler Value?

2 REPLIES 2
jmcallister
Associate II
Posted on October 12, 2006 at 21:40

On the STR711FR2, how do I determine a timer prescaler value? I would like

The Reference manual shows a function of

delta_OCiR = (delta_t * f_PCLK2) / (CC7 / CC0 + 1)

Since CC7 and CC0 are bits, do I use the entire CC register as the prescale value?

I currently have the timer running and the interrupts working, but the period of the timer is not what I expect.

Thanks.

//

// Configure the EIC channel interrupt

//

EIC_IRQChannelPriorityConfig( T0TIMI_IRQChannel, 1 );

EIC_IRQChannelConfig( T0TIMI_IRQChannel, ENABLE );

EIC_IRQConfig( ENABLE );

//

// Initialize the Timer

//

TIM_Init ( TIM0 );

//

// Configure the TIM Prescaler - Div by 2

//

TIM_PrescalerConfig ( TIM0, 0x02 ); // ???

//

// Enable the Output Compare for the TIM0 peripheral

//

TIM_ITConfig ( TIM0, TIM_OCA_IT, ENABLE );

//

// Output compare mode peripheral Mode Config

// (TIMx, TIM_CHANNEL_x, Output Compare Value, Output Compare Mode, Level after Match)

//

TIM_OCMPModeConfig ( TIM0, TIM_CHANNEL_A, 0x8000, TIM_TIMING, TIM_HIGH );

[ This message was edited by: justinm on 13-10-2006 01:14 ]

alain2399
Associate II
Posted on October 13, 2006 at 12:30

You took the wrong forum. You should post your question in the STR7 forum, here it is the ST7 (8 bit) forum.