I'm trying to use the timer registers to do some timing on my Arduino Mega 2560.
The output of the following code confuses me:
void setup ()
{
// Set up serial connection
Serial.begin(9600);
while (!Serial) {}
// Print control registers of timer 1
Serial.println(TCCR1A); // Outputs 1
Serial.println(TCCR1B); // Outputs 3
}
void loop () {}
Why is TCCR1A
equal to 1
and TCCR1B
equal to 3
? The documentation of the chip says the initial values of the registers are zero. I could of course set them to zero, but I want to understand why it works like this. The values are the same for the other 16-bit timers (3, 4 and 5).