Maybe it's a silly question:
I have internal 20 MHz oscillator, 16 bit timer and prescalers (1, 2, 4, 8, 16, 32, 64, 128) and I want to generate 1 ms delay. I know how to do that - (20 000 000 / 1) / 1000 = 20 000 -> put this value to 16 bit register and it works.
With prescalers 2 and 4, I have the same result 1ms - (20 000 000 / 2) / 1000 = 10 000 and (20 000 000 / 4) / 1000 = 5 000
My question is how to determine which prescaler to use ? Maybe, I have to choose prescaler 4, because this value (5000) is closer to 0 and my timer starts to count from 0 to 5000. If I choose 10 000, the timer will count 2 x 5000.
Thank you in advance !