declare tone_incr to be volatile to prevent the compiler optimizing frequency() out of existence