A system and method for controlling electromechanical valves operating in an engine is presented. According to the method, valve timing can be adjusted in a number of ways. The method can also compensate for changes in the natural response of the valve apparatus.