Input Capture Mode (Timer 1 Atmega 328)

Hi all!
My project, I use Input capture mode to measure the speed of a bicycle (based on the switching frequency of the switch).I use library FreqMeasure (reference FreqMeasure Library, for Measuring Frequencies in the 0.1 to 1000 Hz range, or RPM Tachometer Applications).
My problem: I do not really understand vector interrupt TIMER1_CAPT_vect. When this interrupt occurs? It looks like it interrupt when there is a change levels logic, so the set ICES1 (0-falling edge or 1-rising edge) to the setting of the edge detector has no effect.
In my case:

When the switch is OFF, D8 pin is HIGH. Switch is ON, D8 pin is LOW.
As I understand, when I set ICES1 = 0 (falling edge detector), interrupt TIMER1_CAPT_vect only happened one time when the switch status from OFF to ON (HIGH to LOW logic).But in fact it is not true.
P/s: I really do not understand FreqMeasure library. If anyone has good speed measurements please help me or explain and how to use this libraty (FreqMeasure) in my case (measure the speed of a bicycle).
Thank in advance!

nhatnam06dt1:
When this interrupt occurs? It looks like it interrupt when there is a change levels logic, so the set ICES1 (0-falling edge or 1-rising edge) to the setting of the edge detector has no effect.

According to the datasheet:

The Input Capture Register can capture the Timer/Counter value at a given external (edge triggered) event on either the Input Capture pin (ICP1) or on the Analog Comparator pins (See ”Analog Comparator” on page 246) The Input Capture unit includes a digital filtering unit (Noise Canceler) for reducing the chance of capturing noise spikes.

So it looks like on a logic change.

Sounds like the problem might be your switch. If it contact bounces, the capture vector will fire repeatedly. Since you are timing the full revolution of the wheel, you can trigger on either edge you want and not worry about changing it while running. What kind of switch are you using?

I can't tell you anything about using that library, but I know how to use Timer1 Capture and Overflows to measure cycle time or pulse width, whichever you need. I'm tinkering with a project right now that measures cycle length to .5uS precision using Timer1 captures. It screws up PWM on pins 9 and 10 though because I changed the timer settings.

So it looks like on a logic change.

But as the datasheet:

When a change of the logic level (an event) occurs on the Input Capture pin (ICP1), alternatively on the Analog Comparator output (ACO), and this change confirms to the setting of the edge detector, a capture will be triggered