cancel
Showing results for 
Search instead for 
Did you mean: 

STM8S003 BUG IN TIMER(not confirmed)

qinyongliang
Associate
Posted on December 21, 2014 at 18:18

set up the prescaler and period, and let it run.

then at certain point, I want to set the counter to some specific value. however, it seems that setting counter using TIM1_SetCounter(), can actually clear the prescaler setting(TIM1->PSCR = 0). I wasn't sure whether this is a silicon bug or not. would anyone make a test about this problem with his STM8S? and solution: set the desired prescaler immediately after SetCounter(), like my example below.

void
setcntr()
{
TIM1_SetCounter(1);
TIM1->PSCRH = 0;
TIM1->PSCRL = 15;
TIM1->EGR =TIM1_PSCRELOADMODE_IMMEDIATE;
}

0 REPLIES 0