Hi, I have the following TimerA1 configuration for a simple square wave generation program:
- SMCLK is selected as clock source
- Source for SMCLK is DCO with DCOFSEL_6 and DIVS=8, therefore yielding a 1 MHz clock for SMCLK in theory
- Up Mode
Whenever there is an interrupt, I toggle a pin.
However, when I set CCR0 to 2500 I get a frequency of 200 Hz on the oscilloscope.
This would mean that:
200 Hz = ( (f_clk)^-1 * 2500)^-1.
f_clk = 500,000Hz
Why is this, shouldn't the frequency read from the oscilloscope be 400Hz in this case, since SMCLK=1MHz? I know I am missing something. Thank you for the explanation in advance.
Edit 1: Also as a note, for TimerA1:
- ID = 0
- TAIDEX = 0
So there shouldn't be any more division at the TimerA level...
Edit 2: Edited question for clarity