Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • The main problem here is that when while loops are accessing variable "e" here, to check whether e<2.... program's unable to come out of loop (ISR is not changing "e").. but when some code like "Serial.print(e)" is kept in while loop...i.e. it spent some time not accessing "e" to communicate serially, its able to come out of the loop. Actually this must not be a problem as when ISR are addressed the main stack remains as it is n returns where it left. Commented Jan 4, 2015 at 18:04
  • 1
    @Wupadrasta I suspect the ISR is executing correctly, but the while loop is simply operating on a different (cached) copy of e. Declaring it as volatile should solve that. Commented Jan 4, 2015 at 21:36
  • 1
    Thanks a lot... I learned about volatile qualifiers but didn't know where to use them.It worked... Thanq. Commented Jan 10, 2015 at 7:53