AnsweredAssumed Answered

TIM4 weird results

Question asked by Moffa.J_r_my on Dec 15, 2016
Latest reply on Jan 24, 2017 by Moffa.J_r_my

Hello, I am using stm8s003f3 and I wanted to count with 1 ms of precision and it works well.

 

I use a prescaler of 128 and a period of 125 and if I use my delay function with 1000 as parameter, I get the second.

 

However if I use a prescaler of 16 and period of 1, normally I get 1 µs precision but my delay function with 1000000 is logically 1 second too but it's +- 7s

 

I don't know what I'm doing wrong so if someone can help me.

 

My main.c http://pastebin.com/TgheG5gf

 

stm8_interrupt_vector.c http://pastebin.com/izX7cEVU

 

Thanks !

Outcomes