Perhaps another method might be to use a F-V converter but that will further add hardware to my design....

Here is my piece of code which i find to create the problems...

ISR(SIG_INPUT_CAPTURE1)

{

cli();

sbi(TIFR,ICF1);

temp_TCNT3=TCNT3;

COUNT_PULSE_EDGES++;

if(temp_TCNT3>60000)

cbi(TCCR1B,ICES1);

if(POS_EDGE_ID==FIRST_EDGE) //count positive edge

{

temp_ICP1=ICR1;

count_TmrOverflow=0;

POS_EDGE_ID=SECOND_EDGE;

// FREQ=0;

}

else if(POS_EDGE_ID==SECOND_EDGE)

{

temp_ICP2=ICR1;

if(temp_ICP2>temp_ICP1)

Delta=(temp_ICP2-temp_ICP1);

else if(temp_ICP1>temp_ICP2)

Delta=(temp_ICP1-temp_ICP2);

if(count_TmrOverflow==0)

T_Period=(125*(Delta)); // since the clock speed is 8 MHz , so 1/8 MHz = .125 usec. The result is in nano seconds

else if(count_TmrOverflow==1)

T_Period=(((65536-temp_ICP1)+temp_ICP2)*125);// since its a 16-bit timer so we need to subtract the reading from 65535

else if(count_TmrOverflow>1)

{

count_TmrOverflow-=1;

T_Period=(count_TmrOverflow * 4096000)+(125*((65536-temp_ICP1)+temp_ICP2));

}

// T_Period_Ms=T_Period;//(T_Period/10000); //In fact we wanted to convert the nanosecond reading back into milli second reading

FREQ_OLD=FREQ_NEW;

FREQ=0;

FREQ=(1000000000/T_Period); // but the compiler was unable to show result like 0.166 so we reduced the division

POS_EDGE_ID=FIRST_EDGE; // factor by 10 to get 1.66 and compensated it in freq calculations by adding this factor of 10.

FREQ_NEW=FREQ;

if((FREQ_NEW>=FREQ_OLD-500)&&(FREQ_NEW<FREQ_OLD+500))

COUNT_SAME_FREQ++;

if (COUNT_SAME_FREQ==5)

{

POS_EDGE_ID=THIRD_EDGE;

// cbi(TCCR1B,ICES1);

COUNT_SAME_FREQ=0;

}

COUNT_PULSE_EDGES+=2;

}

sei();

}