timer interrupts on ATtiny x4

Hello,

I am trying to figure if the high level on INT0 is longer or shorter than 70us :

1 bit
<- 50us ->
XXXXXXXX____________

0 bit
<- 100us ->
XXXXXXXXXXXXXXXX___

^
70 us detection

In order to detect the rising edge, I have set up the interrupt on INT0 :

ISR(INT0_vect){
  // to be coded
}

void setup(){
  cli();                                         // disable interrupts during setup
  MUCUR|=(1<<ISC00)|(1<<ISC01);  // setting interrupt on rising edge of INT0
  GIMSK|=(1<<INT0);                     // enable interrupt on INT0
  sei();                                         // Global interrupt enable
}

I know want to set a timer interrupt 70us after the external interrupt. I have no idea of how to implement it.

What you want to do is use Timer1 in "Input capture" mode, it is designed for measuring pulse lengths like this.

Yes, when I detect the rising edge I can put the timer 1 (TCNT1) at 0, and I can compare it to OCR1A.

But how can I activate the timer interruption ?

I have found a solution with the overflow interrupt :
I set the overflow interrupt (setting the first bit of TIMSK1) and put TCNT1 (counter) to a certain value when I detect the rising edge, then I am able to detect the overflow and clear the first bit of TIMSK1.

Do you think that it would be better to use a comparison (with OCR1A for example) ?

Thank you for your answer which gives me the name for searching

Tutorial on Timers and Input Capture mode (scroll down the page for Input Capture).