Counting missed pulses

Hi all,
I've arduino UNO that I have been using for project. Now I want to use this to count missed pulses. I'm generating the pulse from external micro that generates 10usec width every 25 ms. I want to count if this pulses going to have missed pulses for 28 days. I was thinking to use a timer to see if it can stamp time when it missed that pulse, and also to use store the data in different registers every other day.


Is there a question here?

It is very doable.

Yes the question is how can I do it? Do I have to use interrupt?

No, you can certainly poll a pin.

With an interrupt you check to see if it has been too long since the last one.

Psuedo code for polling:

Wait for pin to go high.

When pin goes high:
Note the time.
Compare to last pin-high time
If missed pulse detected log time

Wait for pin to go low.

I couldn't get the count to keep increment.

byte freqpin = 3;

int Counter;

void setup()
{ pinMode(freqpin,INPUT);
int n = 0;

void loop(){
Counter = pulseIn(freqpin,HIGH); // count set high
while (Counter == HIGH);
Counter = 1;
Serial.print("Count: ");


Then don't set it to 1 at the top of the while loop. And don't increment twice.

Yes the question is how can I do it? Do I have to use interrupt?

I would say yes, you should use an interrupt. Otherwise, you would need to ensure your loop speed is consistently higher than 100,000 iterations per second in order to catch a 10┬Ás pulse. Your interrupts will occur at only 40Hz (25ms interval), which will use very little resources (less than 0.001%).