millis() not incrementing after attachinterrupt

Hello,

I have a program that uses a light sensor that converts light to pulses. I have it connected to PIn2 of a UNO and used attachinterrupt during setup to activate the pulse counting on that pin.

attachInterrupt(0, pulsecnt , RISING);

The pulsecnt function only increments a counter:

void pulsecnt(){
cnt++;
}

However I noticed that for some reason, after I use the attachinterrupt function, millis() stop working, and pulse counting continues as it should. But the strange thing is that this behaviour is not constant, sometimes it works, sometime don't.

The code is very extense and full of libs, so I won't copy it here.

Is it possible that the pulse counting on PIN2 is interfeering with the millis() function??

Thx

Try here

The code is very extense and full of libs

Good job you caught this thing early then.

Thiapalm:
The code is very extense and full of libs, so I won't copy it here.

The problem is ALWAYS in the code that you don't post.

BTW attachInterrupt does NOT stop millis updating.

As another guess, have you declared cnt as volatile?

KenF:
The problem is ALWAYS in the code that you don't post.

BTW attachInterrupt does NOT stop millis updating.

Amen.

The code was working for months now....

And by the way, the question was:

"Is it possible that the pulse counting on PIN2 is interfeering with the millis() function??"

KenF:
As another guess, have you declared cnt as volatile?

Sorry KenF, I forgot to answer to your question.

Yes, it is declared as Volatile.

Ok. I think you need to look through your code very carefully to work out what you've done wrong. Maybe a semi colon on the end of an IF statement, or a single '=' where a double belongs. But we can only guess.

Good luck

Or maybe you've just used too much RAM.

But like the man said, good luck.