user4396: I'm trying to check the frequency of Timer3 using a counter. The value of the counter, declared as volatile, is incremented in the ISR and every second the sum is shown in the main loop and the value reset to zero. 
The timer has been set up correctly. (If I choose a 3Hz timer I can see the led blinking)
The problem
The counter isn't incremented. Here is the output:
Setup Completed
tick: 1
tick: 0
tick: 0
tick: 0

CODE
volatile int cont = 0;

void setup()
{
  Serial.begin(9600);

  pinMode(13, OUTPUT);

  // Initialize Timer
  cli();          // disable global interrupts
  TCCR3A = 0;     // set entire TCCR3A register to 0
  TCCR3B = 0;     // same for TCCR3B

  // set compare match register to desired timer count: 800 Hz
  OCR3B = 20; // 800Hz 5; // 3 Hz
  // turn on CTC mode:
  TCCR3B |= (1 << WGM12);
  // Set CS10 and CS12 bits for 1024 prescaler:
  TCCR3B |= (1 << CS30) | (1 << CS32);
  // enable timer compare interrupt:
  TIMSK3 |= (1 << OCIE3B);
  // enable global interrupts:
  sei();

  Serial.println("Setup completed");
}

void loop()
{
  if (millis() % 1000 == 0)
  {
    Serial.print(" tick: ");
    Serial.println(cont);
    cont = 0;
  }
}

ISR(TIMER3_COMPB_vect)
{
  //digitalWrite(13, digitalRead(13) ^ 1);
  cont++;
}

EDIT
This timer is used to read an anlog value from an accelerometer and store it in an array of float. But at the moment I'm stuck on this update issue.
SOLUTION 1
Thanks to Gerben
volatile int cont = 0;

void setup()
{
  Serial.begin(9600);
  pinMode(13, OUTPUT);

  // Initialize Timer
  cli();          // disable global interrupts
  TCCR3A = 0;     // set entire TCCR3A register to 0
  TCCR3B = 0;     // same for TCCR3B

  // set compare match register to desired timer count: 800 Hz
  OCR3A = 20; // 20; //800Hz 5; // 3 Hz
  // turn on CTC mode:
  TCCR3B |= (1 << WGM32);
  // Set CS10 and CS12 bits for 1024 prescaler:
  TCCR3B |= (1 << CS30) | (1 << CS32);
  // enable timer compare interrupt:
  TIMSK3 |= (1 << OCIE3B);
  // enable global interrupts:
  sei();
  Serial.println("Setup completed");
}

void loop()
{
  delay(1000);
  Serial.println(cont);
  cont = 0;
}

ISR(TIMER3_COMPB_vect)
{
  cont++;
}

SOLUTION 2
Thanks to BrettM
volatile int cont = 0;

void setup()
{
  Serial.begin(9600);
  pinMode(13, OUTPUT);

  // Initialize Timer
  cli();          // disable global interrupts
  TCCR3A = 0;     // set entire TCCR3A register to 0
  TCCR3B = 0;     // same for TCCR3B

  // set compare match register to desired timer count: 800 Hz
  OCR3B =  20; //800Hz 5; // 3 Hz
  // turn on CTC mode:
  //TCCR3B |= (1 << WGM32);
  // Set CS10 and CS12 bits for 1024 prescaler:
  TCCR3B |= (1 << CS30) | (1 << CS32);
  // enable timer compare interrupt:
  TIMSK3 |= (1 << OCIE3B);
  // enable global interrupts:
  sei();
  Serial.println("Setup completed");
}

void loop()
{
  Serial.println(cont); 
  cont = 0;
  delay(1000);

}

ISR(TIMER3_COMPB_vect)
{
  TCNT3 = 0;
  cont++;
}


user1585: It seems my answer to this question was previously incomplete, thanks for pointing out that CTC mode only works with OCR3A Gerben. I apologize for not testing an answer before I post it.
Given the information only in this question Gerben's answer is complete, but since your other question implies that you cannot use OCR3A due to the Servo library I'll add a bit. (I've also edited that answer)
you can emulate the behavior of CTC mode by setting TCNT3 to 0 in your interrupt routine. Remember to remove the line that turns on CTC mode in your code.
I've tested your code with this ISR:
ISR(TIMER3_COMPB_vect)
{
  TCNT3 = 0;
  cont++;
}

and this configuration of the timer registers 
OCR3B = 5208; // 800Hz 5; // 3 Hz
// Set CS10 and CS12 bits for 1024 prescaler:
TCCR3B |= (1 << CS30) | (1 << CS32);
// enable timer compare interrupt:
TIMSK3 |= (1 << OCIE3B);

This might be a bit less accurate at high frequencies than CTC, I'm not sure, but at 3Hz it worked perfectly. Notice that 5208 was the correct OCR value, not 20 (again thanks to Gerben). 

user2881: In CTC mode the top is OCR3A, not OCR3B!
After that TIMSK3 |= (1 << OCIE3B); should also be changed to TIMSK3 |= (1 << OCIE3A);, and ISR(TIMER3_COMPB_vect) to ISR(TIMER3_COMPA_vect)
For 3Hz, OCR3A should be 5208, not 20.
Technically TCCR3B |= (1 << WGM12); should be TCCR3B |= (1 << WGM32);

4396: <p>I'm trying to check the frequency of Timer3 using a counter. The value of the counter, declared as volatile, is incremented in the ISR and every second the sum is shown in the main loop and the value reset to zero. </p>

<p>The timer has been set up correctly. (If I choose a 3Hz timer I can see the led blinking)</p>

<p><strong>The problem</strong></p>

<p>The counter isn't incremented. Here is the output:</p>

<pre><code>Setup Completed
tick: 1
tick: 0
tick: 0
tick: 0
</code></pre>

<p><strong>CODE</strong></p>

<pre><code>volatile int cont = 0;

void setup()
{
  Serial.begin(9600);

  pinMode(13, OUTPUT);

  // Initialize Timer
  cli();          // disable global interrupts
  TCCR3A = 0;     // set entire TCCR3A register to 0
  TCCR3B = 0;     // same for TCCR3B

  // set compare match register to desired timer count: 800 Hz
  OCR3B = 20; // 800Hz 5; // 3 Hz
  // turn on CTC mode:
  TCCR3B |= (1 &lt;&lt; WGM12);
  // Set CS10 and CS12 bits for 1024 prescaler:
  TCCR3B |= (1 &lt;&lt; CS30) | (1 &lt;&lt; CS32);
  // enable timer compare interrupt:
  TIMSK3 |= (1 &lt;&lt; OCIE3B);
  // enable global interrupts:
  sei();

  Serial.println("Setup completed");
}

void loop()
{
  if (millis() % 1000 == 0)
  {
    Serial.print(" tick: ");
    Serial.println(cont);
    cont = 0;
  }
}

ISR(TIMER3_COMPB_vect)
{
  //digitalWrite(13, digitalRead(13) ^ 1);
  cont++;
}
</code></pre>

<p><strong>EDIT</strong>
This timer is used to read an anlog value from an accelerometer and store it in an array of float. But at the moment I'm stuck on this update issue.</p>

<p><strong>SOLUTION 1</strong>
Thanks to Gerben</p>

<pre><code>volatile int cont = 0;

void setup()
{
  Serial.begin(9600);
  pinMode(13, OUTPUT);

  // Initialize Timer
  cli();          // disable global interrupts
  TCCR3A = 0;     // set entire TCCR3A register to 0
  TCCR3B = 0;     // same for TCCR3B

  // set compare match register to desired timer count: 800 Hz
  OCR3A = 20; // 20; //800Hz 5; // 3 Hz
  // turn on CTC mode:
  TCCR3B |= (1 &lt;&lt; WGM32);
  // Set CS10 and CS12 bits for 1024 prescaler:
  TCCR3B |= (1 &lt;&lt; CS30) | (1 &lt;&lt; CS32);
  // enable timer compare interrupt:
  TIMSK3 |= (1 &lt;&lt; OCIE3B);
  // enable global interrupts:
  sei();
  Serial.println("Setup completed");
}

void loop()
{
  delay(1000);
  Serial.println(cont);
  cont = 0;
}

ISR(TIMER3_COMPB_vect)
{
  cont++;
}
</code></pre>

<p><strong>SOLUTION 2</strong>
Thanks to BrettM</p>

<pre><code>volatile int cont = 0;

void setup()
{
  Serial.begin(9600);
  pinMode(13, OUTPUT);

  // Initialize Timer
  cli();          // disable global interrupts
  TCCR3A = 0;     // set entire TCCR3A register to 0
  TCCR3B = 0;     // same for TCCR3B

  // set compare match register to desired timer count: 800 Hz
  OCR3B =  20; //800Hz 5; // 3 Hz
  // turn on CTC mode:
  //TCCR3B |= (1 &lt;&lt; WGM32);
  // Set CS10 and CS12 bits for 1024 prescaler:
  TCCR3B |= (1 &lt;&lt; CS30) | (1 &lt;&lt; CS32);
  // enable timer compare interrupt:
  TIMSK3 |= (1 &lt;&lt; OCIE3B);
  // enable global interrupts:
  sei();
  Serial.println("Setup completed");
}

void loop()
{
  Serial.println(cont); 
  cont = 0;
  delay(1000);

}

ISR(TIMER3_COMPB_vect)
{
  TCNT3 = 0;
  cont++;
}
</code></pre>
 1585: <p>It seems my answer to <a href="https://arduino.stackexchange.com/questions/5396/setting-timer3-in-ctc-mode-conflict-with-servo-library/5432#5432">this question</a> was previously incomplete, thanks for pointing out that CTC mode only works with OCR3A Gerben. I apologize for not testing an answer before I post it.</p>

<p>Given the information only in this question Gerben's answer is complete, but since your other question implies that you cannot use OCR3A due to the Servo library I'll add a bit. (I've also edited that answer)</p>

<p>you can emulate the behavior of CTC mode by setting TCNT3 to 0 in your interrupt routine. Remember to remove the line that turns on CTC mode in your code.</p>

<p>I've tested your code with this ISR:</p>

<pre><code>ISR(TIMER3_COMPB_vect)
{
  TCNT3 = 0;
  cont++;
}
</code></pre>

<p>and this configuration of the timer registers </p>

<pre><code>OCR3B = 5208; // 800Hz 5; // 3 Hz
// Set CS10 and CS12 bits for 1024 prescaler:
TCCR3B |= (1 &lt;&lt; CS30) | (1 &lt;&lt; CS32);
// enable timer compare interrupt:
TIMSK3 |= (1 &lt;&lt; OCIE3B);
</code></pre>

<p>This might be a bit less accurate at high frequencies than CTC, I'm not sure, but at 3Hz it worked perfectly. Notice that 5208 was the correct OCR value, not 20 (again thanks to Gerben). </p>
 2881: <p>In CTC mode the top is <code>OCR3A</code>, not <code>OCR3B</code>!</p>

<p>After that <code>TIMSK3 |= (1 &lt;&lt; OCIE3B);</code> should also be changed to <code>TIMSK3 |= (1 &lt;&lt; OCIE3A);</code>, and <code>ISR(TIMER3_COMPB_vect)</code> to <code>ISR(TIMER3_COMPA_vect)</code></p>

<p>For 3Hz, <code>OCR3A</code> should be 5208, not 20.</p>

<p>Technically <code>TCCR3B |= (1 &lt;&lt; WGM12);</code> should be <code>TCCR3B |= (1 &lt;&lt; WGM32);</code></p>
