Here is the code, reply #4.
That code is using the ICP(input capture) pin. ICP5 is on D48.
The OP claims that he only has the external clock source pin(T5) on D47 available.
If that's the case, you can not determine the pulse characteristics, but only the count the number of pulses in a period of time.
You will be using the timer/counter as a counter. Here is some sample code written for Timer1 on a UNO.
unsigned long count_period = 2000;
unsigned int count_to_rpm = 60000UL / count_period; //convert counts to RPM
byte number_of_sensors = 1;
unsigned long final_counts;
unsigned long start_time = millis();
unsigned long measured_time;
unsigned long current_time = millis();
void setup()
{
Serial.begin(115200);
TCCR1A = 0; //initialize Timer1
TCCR1B = 0;
TCNT1 = 0;
pinMode( 5, INPUT_PULLUP); //external source pin for timer1
//set external clock source pin D5 rising edge
TCCR1B = bit (CS10) | bit (CS11) | bit (CS12);
//Test pulses to confirm circuit 50 pps = 3000
//pinMode(11, OUTPUT);
//tone(11, 50);//test pulse jumper pin 11 to pin 5
}
void loop()
{
current_time = millis();
if (current_time - start_time >= count_period)
{
TCCR1B = 0; //stop counter
final_counts = TCNT1; //frequency limited by unsigned int TCNT1 without rollover counts
TCNT1 = 0;
measured_time = current_time - start_time;
start_time = current_time;;
unsigned int rpm = (final_counts * count_to_rpm) / number_of_sensors;
TCCR1B = bit (CS10) | bit (CS11) | bit (CS12); //restart external clock source
Serial.print(measured_time);
Serial.print("\t\t");
Serial.print(final_counts);
Serial.print("\t\t");
Serial.println(rpm);
}
}