I am using STM8S Cosmic C compiler, and I am trying to configure tim2 for 350 µs (350 µs should be the pulse width).
As per the reference manual, tim4 is a 16-bit with a prescaler factor of 32768. I will be using the internal 2 MHz clock
My calculations are as follows:
1/2000000 Hz = 0.0000005 seconds ~ 0.5 µs
If we use a 128 prescaler:
128 * 0.5 µs = 64 µs
I want each pulse to be of 350 µs, how do I calculate that? Are the calculations are wrong too?
I am trying to calculate it for 350 µs, but I am not getting actual value and need guidance!