A method of generating a digital control signal for controlling the duty cycle of a switched mode power supply, the method comprising: receiving a signal indicative of the input voltage (V in) of the switched mode power supply; receiving a signal indicative of the output voltage (V out) of the switched mode power supply; detecting a transient on the received signal indicative of the input voltage (V in) of the switched mode power supply; and in response to the detection of a said transient: performing a voltage feedback adjustment of the control signal for controlling the duty cycle of the switched mode power supply by adjusting the control signal in dependence upon the signal indicative of the output voltage (S406, S409); in a first stage of feed forward compensation, performing a coarse voltage feed forward adjustment of the control signal for controlling the duty cycle of the switched mode power supply by setting the value of the control signal to a valve (D cut) derived by performing at least one bitshift operation on the value of the control signal (S404, S407); and in a second stage of feed forward compensation, performing a more accurate voltage feed forward adjustment of the control signal for controlling the duty cycle of the switched mode power supply by setting the value of the control signal to a value (D new) calculated in dependence upon the signal indicative of the input voltage (V in) of the switched mode power supply (S405, S408, S410); wherein the first and second stages of the feed forward compensation are performed such that the control signal is set to the value derived in the first stage before the control signal is set to the value calculated in the second stage. receiving a signal indicative of the input voltage (V in) of the switched mode power supply; receiving a signal indicative of the output voltage (V out) of the switched mode power supply; detecting a transient on the received signal indicative of the input voltage (V in) of the switched mode power supply; and in response to the detection of a said transient: performing a voltage feedback adjustment of the control signal for controlling the duty cycle of the switched mode power supply by adjusting the control signal in dependence upon the signal indicative of the output voltage (S406, S409); in a first stage of feed forward compensation, performing a coarse voltage feed forward adjustment of the control signal for controlling the duty cycle of the switched mode power supply by setting the value of the control signal to a valve (D cut) derived by performing at least one bitshift operation on the value of the control signal (S404, S407); and in a second stage of feed forward compensation, performing a more accurate voltage feed forward adjustment of the control signal for controlling the duty cycle of the switched mode power supply by setting the value of the control signal to a value (D new) calculated in dependence upon the signal indicative of the input voltage (V in) of the switched mode power supply (S405, S408, S410); wherein the first and second stages of the feed forward compensation are performed such that the control signal is set to the value derived in the first stage before the control signal is set to the value calculated in the second stage. performing a voltage feedback adjustment of the control signal for controlling the duty cycle of the switched mode power supply by adjusting the control signal in dependence upon the signal indicative of the output voltage (S406, S409); in a first stage of feed forward compensation, performing a coarse voltage feed forward adjustment of the control signal for controlling the duty cycle of the switched mode power supply by setting the value of the control signal to a valve (D cut) derived by performing at least one bitshift operation on the value of the control signal (S404, S407); and in a second stage of feed forward compensation, performing a more accurate voltage feed forward adjustment of the control signal for controlling the duty cycle of the switched mode power supply by setting the value of the control signal to a value (D new) calculated in dependence upon the signal indicative of the input voltage (V in) of the switched mode power supply (S405, S408, S410); wherein the first and second stages of the feed forward compensation are performed such that the control signal is set to the value derived in the first stage before the control signal is set to the value calculated in the second stage.