Timer1 ISR running too fast than expected

Hi
I want an Output Compare Timer 1 ISR to be fired every 0.25s
So I used the Timer1 (16 bits) with 256 prescaler and an OCR1 = 15625
62.5 ns * 15625* 256 = 0.25s

but it runs too fast
what is wrong with this code
Thanks

#include <Streaming.h>d

int is, quartsec;

void setup()
{
  Serial.begin(115200);
  is = 0;
  cli(); // Désactive l'interruption globale
  TCCR1A = 0;	// pas de PWM ou OC output
  TCCR1B = (0<<WGM13) | (1<<WGM12) | 4;	// Clear Timer on Compare match (CTC) mode, OCR1A= PRD
																				// CS12 CS11 CS10 = 0b100 = 4 =>256 prescaler
  //OCR1A = 15625 = 0x3D09;	// 62.5 ns * 15625 * 256 presacler = 0.250 s
  OCR1AL = 0x09;
  OCR1AH = 0x3D;
  // pas de compteur logiciel
  TIMSK1 = 1<<OCIE1A; // ISR on Output Compare1 (TCNT1==OCR1)
	TIFR1 = 0;	// clear T1 IF
  TCNT1L = 0; // RAZ T1
  TCNT1H = 0; 
  sei(); // Active l'interruption globale
}

// Routine d'interruption
ISR(TIMER1_COMPA_vect) {  // 250 ms sont passés, IF RAZ automatiquement
  is++; // raffraichie localement de 0 à 239, RAZ ds chech

	Serial << quartsec << F("  is=") << is << endl;
	
	if (++quartsec == 4)  {
		quartsec = 0;
	}
}
//----------------------------------------------------------------------------

 //----------------------------------------------------------------------------
void loop()
{
}

In C(++) this...

  OCR1A = 15625;   // 62.5 ns * 15625 * 256 presacler = 0.250 s

...is the correct way to set the OCR1A register. The compiler takes care of instruction ordering. I mention this fact because...

  OCR1AL = 0x09;
  OCR1AH = 0x3D;

...you are doing it the wrong way round. Ditto for TCNT1.

thanks a lot works well now

Is there a wiki to find this Syntax ?

I mean I had to look inside the ATmega48A, ATmega48PA, ATmega88A, ATmega88PA, ATmega168A, ATmega1688PA, ATmega328, ATmega328P datasheet

and \Arduino\hardware\arduino\avr\bootloaders\stk500v2\ .h to find the name : TIMER1_COMPA_vect for example

blotfib: thanks a lot

You are welcome.

Is there a wiki to find this Syntax ?

Datasheet. Simple assembly and C examples are provided. For C, just use the register name as listed in the datasheet.

and \Arduino\hardware\arduino\avr\bootloaders\stk500v2\ .h to find the name : TIMER1_COMPA_vect for example

The vector names are sort-of in the datasheet. Spaces are converted to underscores and "_vect" is appended. The section of interest in the datasheet for the ATmega328P processor is "12. Interrupts".

They are also listed in the header file for the processor (iom328p.h for the ATmega328P processor).

blotfib: and \Arduino\hardware\arduino\avr\bootloaders\stk500v2\ .h to find the name : TIMER1_COMPA_vect for example

For the Atmega328P I list them in this post: Interrupts (near the top).