Patent ID: 8866398

Claim:
A controller, comprising: a signal generator configured to receive a sense signal indicating a current flowing through a power converter that receives an input voltage and provides an output voltage to power a load, receive a detection signal indicating whether said power converter operates in a predetermined state, and generate a square wave signal according to said sense signal and said detection signal, wherein said square wave signal has a first voltage level proportional to a peak level of said current when said power converter operates in said predetermined state, and otherwise said square wave signal has a second voltage level; and a driver coupled to said signal generator and configured to generate a driving signal based on said square wave signal to control a current flowing through said load, wherein said signal generator comprises: a sampling circuit configured to detect said peak level of said current through said power converter according to said sense signal, and generate a peak signal having said first voltage level; and a switch coupled to said sampling circuit, wherein said switch transfers said peak signal to said driver when said power converter operates in said predetermined state; otherwise, said switch transfers a reference signal having said second voltage level to said driver.