How do I measure pin HIGH/LOW length in interrupts?

I am trying to read an Infra red receiver's signal by measuring the pulse width of HIGH and LOW. And I want to do it in interrupts. Apparently I could not use "pulsein" in interrupts right?

Each pulse lengths about 100 microseconds, so I tried to set a timer by triggering the interrupts in every 1 microseconds (i.e. 16 clock cycle, I am using UNO) hoping to count the HIGH and LOW signals. It seems to be too fast and the program could not function well.

So can I get some suggestions here about what should I do this properly? Thank you all!

may be you can study what they do in IRLib2?

check as well the IRLibReference.pdf PDF

If you are measuring consecutive LOW and HIGH bit times you can't use pulseIn() anyway. If you look for a HIGH pilse it will wait until the signal is LOW before waiting for it to change to HIGH to start the timing. You would miss probably two out of three pulses.

The IRremote library uses a timer running at 50 microseconds to record pulse lengths. That would not be fast enough if your pulses are vary by less than 50 microseconds.

What many RC folks do with pulse signals from an RC receiver is connect it to a CHANGE interrupt on either an External Interrupt pin or using a Pin Change Interrupt. The ISR records the interval between this change and the previous change. Make sure your ISR doesn't go off the end of the buffer! As part of that it stores the current time from micros(). The loop() can look at micros() and the latest time recorded by the ISR to see if the line has gone idle (signal is over). The buffered pulses can then be interpreted. If you need even more precision you can run Timer1 at 16 MHz and use that as a timer. That will allow you to time pulses up to about 4 milliseconds very precisely.

Detach the interrupt when the line has gone idle so you can work on the data without fear of interruption.

Thanks guys. Becoz I need to detect the start bit of my IR signal, that's why I wanted to measure the length of the pulses to see whether it matches the unique length of start bit.

Now I have set a 8.7 us timer of interrupts. 16~20 consecutive TRUE counts would indicate a match of 150-us long start bit. I don't know if this is the smartest way to do so but it works. If you've got any other much better solutions, please do let me know! Cheers!