Input Capture and Wave Generator in AVR