I'm trying to take the time every time an interrupt occurs and find the duration of time that has passed between two interrupts. To accomplish this, I am using millis() in the ISR. I am testing my sketch by asking the Arduino to output the time taken by millis() at every interrupt, to which I keep getting 0s returned on the serial monitor. Intrigued, I tried using micros() to which I kept getting 500s returned on the serial monitor.
Does anyone have any idea as to why the time taken at the ISR's execution is not changing at all? I understand that at the ISR's execution, the clock is kind of frozen and you can't use delay() and such, but I just want to take the time at the execution of the ISR.
My current sketch is attached below. Timer0 is prescaled by 256 and external interrupts on pin 2 are enabled. The interrupts are coming from a square wave generator with 1Hz frequency and 5.0 Vp-p.