A power converter comprises an event detection module detecting various events
of the power converter in real time at the switching frequency of a switch in the
power converter according to predetermined criteria. A pulse generator generates
control signals for controlling the on-times and off-times of the switch based
on the various detected events. The events detected by the event detection module
include a detection of a "knee" in the reflected secondary voltage on the auxiliary
windings of the transformer in a primary side sensing flyback power converter,
and detection of a digital error quantifying the difference between the reference
voltage and the reflected secondary voltage on the auxiliary windings of the transformer
in time domain.