a controller is disclosed which uses pulse width and pulse frequency modulated signals to control a variable to a desired value , the pwm and pfm signals generated through calculation of the difference between the variable and the desired value and then by routing either the pwm or the pfm to the final control element or elements , thereby performing the functions of a proportional and integral controller . derivative action is also disclosed by differentiating the difference , after filtering , and using the relationship between the difference and the differential to determine the routing of the output signal to the final control element or elements .