We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Because the compiler does not know that value of capture_number can change on external event (interrupt), so it presumes it's value will not change unexpectedly.You can check disassembly code to see what the compiler did, sometimes it will even throw out the code if it thinks it does nothing.